1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 23:10:47 -08:00

Replace deprecatd mv with mvff in test cases.

Delete eventrep and replay modules -- these have been broken for a long time. 

Copied from Perforce
 Change: 194843
This commit is contained in:
Gareth Rees 2018-08-01 13:10:09 +01:00
parent 5735d7e78a
commit 4e8de8d42e
46 changed files with 249 additions and 1506 deletions

View file

@ -192,17 +192,8 @@ static void test(mps_arena_class_t arena_class, mps_arg_s arena_args[],
mps_class_mvff(), args), "stress MVFF");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
mps_align_t align = rnd_align(sizeof(void *), MAX_ALIGN);
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, align);
die(stress(arena, NULL, align, randomSizeAligned, "MV",
mps_class_mv(), args), "stress MV");
} MPS_ARGS_END(args);
/* IWBN to test MVFFDebug, but the MPS doesn't support debugging
APs, yet. MV Debug used to work here, because it faked it
through PoolAlloc, but MV Debug is now deprecated and replaced by
MVFF Debug. See job003995. */
allocation points. See job003995. */
(void)options;
MPS_ARGS_BEGIN(args) {

View file

@ -1,689 +0,0 @@
/* eventrep.c: Allocation replayer routines
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* $Id$
*/
#include "config.h"
/* override variety setting for EVENT */
#define EVENT
#include "eventcom.h"
#include "eventrep.h"
#include "eventpro.h"
#include "mpmtypes.h"
#include "mps.h"
#include "mpsavm.h"
#include "mpsacl.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscepvm.h"
#include "fmtpstst.h"
#include "mpscepdl.h"
#include "table.h"
#include <stddef.h> /* for size_t */
#include <stdarg.h> /* for va_list */
#include <stdlib.h> /* for EXIT_FAILURE */
#include <stdio.h> /* for printf */
#include "mpstd.h"
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
#define PRIuLONGEST "llu"
#define PRIXPTR "016llX"
typedef unsigned long long ulongest_t;
#else
#define PRIuLONGEST "lu"
#define PRIXPTR "08lX"
typedef unsigned long ulongest_t;
#endif
typedef unsigned long ulong;
/* Globals */
static ulong totalEvents; /* count of events */
static ulong discardedEvents; /* count of ignored events */
static ulong unknownEvents; /* count of unknown events */
static Word eventTime;
/* Dictionaries for translating from log to replay values */
static Table arenaTable; /* dictionary of arenas */
static Table poolTable; /* dictionary of poolReps */
static Table apTable; /* dictionary of apReps */
/* poolSupport -- describes pool support for explicit deallocation */
enum {supportTruncate = 1, supportFree, supportNothing};
typedef int poolSupport;
/* objectTable -- object address mapping structure
*
* .obj-mapping.truncate: Pools that support truncate need to keep track
* of object end points as well. .obj-mapping.partial-free: Arbitrary
* partial free is not supported.
*/
typedef struct objectTableStruct {
Table startTable;
Table endTable;
} objectTableStruct;
typedef struct objectTableStruct *objectTable;
/* poolRep -- pool tracking structure
*
* .pool.object-addr: Pools that support explicit free (or truncate)
* need to maintain a mapping from the addresses in the log to those in
* the replay.
*
* .bufclass: In order to create APs with the correct arguments, the
* replayer has to pick the right BufferInit event to use, as there's
* one for each superclass. The pool determines the buffer class, so
* we store its subclass level in the pool representation.
*/
typedef struct poolRepStruct {
mps_pool_t pool; /* the replay pool */
objectTable objects;
int bufferClassLevel; /* subclass level of the buffer class */
} poolRepStruct;
typedef struct poolRepStruct *poolRep;
/* apRep -- ap tracking structure */
typedef struct apRepStruct {
mps_ap_t ap; /* the replay ap */
objectTable objects; /* object mapping for the pool of this ap */
} apRepStruct;
typedef struct apRepStruct *apRep;
/* PointerAdd -- add offset to pointer */
#define PointerAdd(p, s) ((void *)((char *)(p) + (s)))
#define PointerSub(p, s) ((void *)((char *)(p) - (s)))
/* error -- error signalling */
ATTRIBUTE_FORMAT((printf, 1, 2))
static void error(const char *format, ...)
{
va_list args;
fflush(stdout); /* sync */
fprintf(stderr, "Failed @%"PRIuLONGEST" ", (ulongest_t)eventTime);
va_start(args, format);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
va_end(args);
exit(EXIT_FAILURE);
}
/* verify, verifyMPS -- check return values
*
* We don't use assert for this, because we want it in release as well.
*/
#define verifyMPS(res) \
MPS_BEGIN if ((res) != MPS_RES_OK) error("line %d MPS", __LINE__); MPS_END
#define verify(cond) \
MPS_BEGIN if (!(cond)) error("line %d " #cond, __LINE__); MPS_END
/* objectTableCreate -- create an objectTable */
static objectTable objectTableCreate(poolSupport support)
{
if (support != supportNothing) {
Res ires;
objectTable table;
table = malloc(sizeof(objectTableStruct));
verify(table != NULL);
ires = TableCreate(&table->startTable, (size_t)1<<12);
verify(ires == ResOK);
if (support == supportTruncate) {
ires = TableCreate(&table->endTable, (size_t)1<<12);
verify(ires == ResOK);
} else {
table->endTable = NULL;
}
return table;
} else {
return NULL;
}
}
/* objectTableDestroy -- destroy an objectTable */
static void objectTableDestroy(objectTable table)
{
if (table != NULL) {
TableDestroy(table->startTable);
if (table->endTable != NULL)
TableDestroy(table->endTable);
free(table);
}
}
/* objDefine -- add a new mapping to an objectTable */
static void objDefine(objectTable table,
void *logObj, void *obj, size_t size)
{
if (table != NULL) {
Res ires;
ires = TableDefine(table->startTable, (TableKey)logObj, obj);
verify(ires == ResOK);
if (table->endTable != NULL) {
ires = TableDefine(table->endTable,
(TableKey)PointerAdd(logObj, size),
PointerAdd(obj, size));
verify(ires == ResOK);
}
}
}
/* objRemove -- look up and remove a mapping in an objectTable */
static void objRemove(void **objReturn, objectTable table,
void *logObj, size_t size)
{
Bool found;
Res ires;
void *obj;
void *end;
void *logEnd;
found = TableLookup(&obj, table->startTable, (TableKey)logObj);
if (found) {
ires = TableRemove(table->startTable, (TableKey)logObj);
verify(ires == ResOK);
if (table->endTable != NULL) {
ires = TableRemove(table->endTable,
(TableKey)PointerAdd(logObj, size));
verify(ires == ResOK);
}
*objReturn = obj;
return;
}
/* Must be a truncation. */
verify(table->endTable != NULL);
logEnd = PointerAdd(logObj, size);
found = TableLookup(&end, table->endTable, (TableKey)logEnd);
verify(found);
obj = PointerSub(end, size);
/* Remove the old end and insert the new one. */
ires = TableRemove(table->endTable, (TableKey)logEnd);
verify(ires == ResOK);
ires = TableDefine(table->endTable, (TableKey)logObj, obj);
verify(ires == ResOK);
*objReturn = obj;
return;
}
/* poolRecreate -- create and record a pool */
static void poolRecreate(void *logPool, void *logArena,
mps_pool_class_t pool_class,
poolSupport support, int bufferClassLevel, ...)
{
va_list args;
mps_pool_t pool;
mps_res_t eres;
poolRep rep;
Res ires;
void *entry;
Bool found;
found = TableLookup(&entry, arenaTable, (TableKey)logArena);
verify(found);
va_start(args, bufferClassLevel);
eres = mps_pool_create_v(&pool, (mps_arena_t)entry, klass, args);
verifyMPS(eres);
va_end(args);
rep = malloc(sizeof(poolRepStruct));
verify(rep != NULL);
rep->pool = pool;
rep->objects = objectTableCreate(support);
rep->bufferClassLevel = bufferClassLevel;
ires = TableDefine(poolTable, (TableKey)logPool, (void *)rep);
verify(ires == ResOK);
}
/* poolRedestroy -- destroy and derecord a pool */
static void poolRedestroy(void *logPool)
{
Res ires;
void *entry;
Bool found;
poolRep rep;
found = TableLookup(&entry, poolTable, (TableKey)logPool);
verify(found);
rep = (poolRep)entry;
mps_pool_destroy(rep->pool);
ires = TableRemove(poolTable, (TableKey)logPool);
verify(ires == ResOK);
objectTableDestroy(rep->objects);
free(rep);
}
/* apRecreate -- create and record an ap */
static void apRecreate(void *logAp, void *logPool, ...)
{
va_list args;
mps_ap_t ap;
poolRep pRep;
apRep aRep;
mps_res_t eres;
Res ires;
void *entry;
Bool found;
found = TableLookup(&entry, poolTable, (TableKey)logPool);
verify(found);
pRep = (poolRep)entry;
va_start(args, logPool);
eres = mps_ap_create_v(&ap, pRep->pool, args);
verifyMPS(eres);
va_end(args);
aRep = malloc(sizeof(apRepStruct));
verify(aRep != NULL);
aRep->ap = ap;
aRep->objects = pRep->objects;
ires = TableDefine(apTable, (TableKey)logAp, (void *)aRep);
verify(ires == ResOK);
}
/* apRedestroy -- destroy and derecord an ap */
static void apRedestroy(void *logAp)
{
Res ires;
void *entry;
Bool found;
apRep rep;
found = TableLookup(&entry, apTable, (TableKey)logAp);
verify(found);
rep = (apRep)entry;
mps_ap_destroy(rep->ap);
ires = TableRemove(apTable, (TableKey)logAp);
verify(ires == ResOK);
free(rep);
}
/* EventReplay -- replay event */
static arenaJustCreated = FALSE;
void EventReplay(Event event, Word etime)
{
mps_res_t eres;
Res ires;
Bool found;
void *entry;
++totalEvents;
eventTime = etime;
switch(event->any.code) {
case EventArenaCreateVM: { /* arena, userSize, chunkSize */
mps_arena_t arena;
eres = mps_arena_create(&arena, mps_arena_class_vm(),
event->pww.w1);
verifyMPS(eres);
ires = TableDefine(arenaTable, (TableKey)event->pww.p0, (void *)arena);
verify(ires == ResOK);
arenaJustCreated = TRUE;
} break;
case EventArenaCreateVMNZ: { /* arena, userSize, chunkSize */
mps_arena_t arena;
eres = mps_arena_create(&arena, mps_arena_class_vmnz(),
event->pww.w1);
verifyMPS(eres);
ires = TableDefine(arenaTable, (TableKey)event->pww.p0, (void *)arena);
verify(ires == ResOK);
arenaJustCreated = TRUE;
} break;
case EventArenaCreateCL: { /* arena, size, base */
mps_arena_t arena;
void *base;
base = malloc((size_t)event->pwa.w1);
verify(base != NULL);
eres = mps_arena_create(&arena, mps_arena_class_cl(),
(Size)event->pwa.w1, base);
verifyMPS(eres);
ires = TableDefine(arenaTable, (TableKey)event->pw.p0, (void *)arena);
verify(ires == ResOK);
arenaJustCreated = TRUE;
} break;
case EventArenaDestroy: { /* arena */
found = TableLookup(&entry, arenaTable, (TableKey)event->p.p0);
verify(found);
mps_arena_destroy((mps_arena_t)entry);
ires = TableRemove(arenaTable, (TableKey)event->pw.p0);
verify(ires == ResOK);
} break;
case EventPoolInitMVFF: {
/* pool, arena, extendBy, avgSize, align, slotHigh, arenaHigh, firstFit */
poolRecreate(event->ppwwwuuu.p0, event->ppwwwuuu.p1,
mps_class_mvff(), supportFree, 0,
(size_t)event->ppwwwuuu.w2,
(size_t)event->ppwwwuuu.w3,
(size_t)event->ppwwwuuu.w4,
(mps_bool_t)event->ppwwwuuu.u5,
(mps_bool_t)event->ppwwwuuu.u6,
(mps_bool_t)event->ppwwwuuu.u7);
} break;
case EventPoolInitMV: { /* pool, arena, extendBy, avgSize, maxSize */
/* .pool.control: The control pool will get created just after */
/* its arena; ignore it. */
if (!arenaJustCreated) {
poolRecreate(event->ppwww.p0, event->ppwww.p1,
mps_class_mv(), supportFree, 0, (size_t)event->ppwww.w2,
(size_t)event->ppwww.w3, (size_t)event->ppwww.w4);
} else {
arenaJustCreated = FALSE;
}
} break;
case EventPoolInitMFS: { /* pool, arena, extendBy, unitSize */
/* internal only */
++discardedEvents;
} break;
case EventPoolInit: { /* pool, arena, class */
/* all internal only */
++discardedEvents;
} break;
case EventPoolFinish: { /* pool */
found = TableLookup(&entry, poolTable, (TableKey)event->p.p0);
if (found) {
poolRedestroy(event->p.p0);
} else {
++discardedEvents;
}
} break;
case EventBufferInit: { /* buffer, pool, isMutator */
if ((Bool)event->ppu.u2) {
found = TableLookup(&entry, poolTable, (TableKey)event->ppu.p1);
if (found) {
poolRep rep = (poolRep)entry;
if(rep->bufferClassLevel == 0) { /* see .bufclass */
apRecreate(event->ppu.p0, event->ppu.p1);
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} break;
case EventBufferInitSeg: { /* buffer, pool, isMutator */
if ((Bool)event->ppu.u2) {
found = TableLookup(&entry, poolTable, (TableKey)event->ppu.p1);
if (found) {
poolRep rep = (poolRep)entry;
if(rep->bufferClassLevel == 1) { /* see .bufclass */
apRecreate(event->ppu.p0, event->ppu.p1);
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} break;
case EventBufferInitRank: { /* buffer, pool, isMutator, rank */
if ((Bool)event->ppuu.u2) {
found = TableLookup(&entry, poolTable, (TableKey)event->ppuu.p1);
if (found) {
poolRep rep = (poolRep)entry;
if(rep->bufferClassLevel == 2) { /* see .bufclass */
apRecreate(event->ppuu.p0, event->ppuu.p1, event->ppuu.u3);
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} else {
++discardedEvents;
}
} break;
case EventBufferFinish: { /* buffer */
found = TableLookup(&entry, apTable, (TableKey)event->p.p0);
if (found) {
apRedestroy(event->p.p0);
} else {
++discardedEvents;
}
} break;
case EventBufferReserve: { /* buffer, init, size */
found = TableLookup(&entry, apTable, (TableKey)event->paw.p0);
if (found) {
apRep rep = (apRep)entry;
mps_addr_t p;
eres = mps_reserve(&p, rep->ap, (size_t)event->paw.w2);
verifyMPS(eres);
} else {
++discardedEvents;
}
} break;
case EventBufferCommit: { /* buffer, p, size, clientClass */
found = TableLookup(&entry, apTable, (TableKey)event->pawa.p0);
if (found) {
apRep rep = (apRep)entry;
mps_addr_t obj = rep->ap->init;
mps_bool_t committed;
size_t size = (size_t)event->pawa.w2;
committed = mps_commit(rep->ap, obj, size);
verifyMPS(committed ? MPS_RES_OK : MPS_RES_FAIL);
objDefine(rep->objects, event->pawa.a1, obj, size);
} else {
++discardedEvents;
}
} break;
case EventPoolAlloc: { /* pool, obj, size */
found = TableLookup(&entry, poolTable, (TableKey)event->paw.p0);
if (found) {
poolRep rep = (poolRep)entry;
void *obj;
size_t size = (size_t)event->paw.w2;
eres = mps_alloc(&obj, rep->pool, size);
verifyMPS(eres);
objDefine(rep->objects, event->paw.a1, obj, size);
} else {
++discardedEvents;
}
} break;
case EventPoolFree: { /* pool, obj, size */
found = TableLookup(&entry, poolTable, (TableKey)event->paw.p0);
if (found) {
poolRep rep = (poolRep)entry;
void *obj;
size_t size = (size_t)event->paw.w2;
objRemove(&obj, rep->objects, event->paw.a1, size);
mps_free(rep->pool, obj, size);
} else {
++discardedEvents;
}
} break;
case EventCommitLimitSet: { /* arena, limit, succeeded */
found = TableLookup(&entry, arenaTable, (TableKey)event->pwu.p0);
verify(found);
eres = mps_arena_commit_limit_set((mps_arena_t)entry,
(size_t)event->pwu.w1);
verifyMPS(((Bool)event->pwu.u2 == (eres == MPS_RES_OK))
? MPS_RES_OK : MPS_RES_FAIL);
} break;
case EventSpareCommitLimitSet: { /* arena, limit */
found = TableLookup(&entry, arenaTable, (TableKey)event->pw.p0);
verify(found);
(void)mps_arena_spare_commit_limit_set((mps_arena_t)entry,
(size_t)event->pw.w1);
} break;
case EventVMMap: case EventVMUnmap:
case EventVMInit: case EventVMFinish:
case EventArenaWriteFaults:
case EventArenaAlloc: case EventArenaAllocFail: case EventArenaFree:
case EventSegAlloc: case EventSegAllocFail: case EventSegFree:
case EventSegMerge: case EventSegSplit:
case EventBufferFill: case EventBufferEmpty:
case EventCBSInit: case EventMeterInit: case EventMeterValues:
case EventIntern: case EventLabel: {
++discardedEvents;
} break;
default: {
++unknownEvents;
if (unknownEvents < 12) /* don't output too much */
printf("Unknown event @%ld: %s.\n", etime,
EventCode2Name(EventGetCode(event)));
} break;
}
}
/* Checking macros, copied from check.h */
#define COMPATLVALUE(lv1, lv2) \
((void)sizeof((lv1) = (lv2)), (void)sizeof((lv2) = (lv1)), TRUE)
#define COMPATTYPE(t1, t2) \
(sizeof(t1) == sizeof(t2) && \
COMPATLVALUE(*((t1 *)0), *((t2 *)0)))
/* CHECKCONV -- check t2 can be cast to t1 without loss */
#define CHECKCONV(t1, t2) \
(sizeof(t1) >= sizeof(t2))
/* EventRepInit -- initialize the module */
Res EventRepInit(void)
{
Res res;
/* Check using pointers as keys in the tables. */
verify(CHECKCONV(Word, void *));
/* Check storage of MPS opaque handles in the tables. */
verify(COMPATTYPE(mps_arena_t, void *));
verify(COMPATTYPE(mps_ap_t, void *));
/* .event-conv: Conversion of event fields into the types required */
/* by the MPS functions is justified by the reverse conversion */
/* being acceptable (which is upto the event log generator). */
totalEvents = 0; discardedEvents = 0; unknownEvents = 0;
res = TableCreate(&arenaTable, (size_t)1);
if (res != ResOK)
goto failArena;
res = TableCreate(&poolTable, (size_t)1<<4);
if (res != ResOK)
goto failPool;
res = TableCreate(&apTable, (size_t)1<<6);
if (res != ResOK)
goto failAp;
return ResOK;
failAp:
TableDestroy(poolTable);
failPool:
TableDestroy(arenaTable);
failArena:
return res;
}
/* EventRepFinish -- finish the module */
void EventRepFinish(void)
{
/* @@@@ add listing of remaining objects? */
/* No point in cleaning up the tables, since we're quitting. */
printf("Replayed %lu and discarded %lu events (%lu unknown).\n",
totalEvents - discardedEvents - unknownEvents,
discardedEvents + unknownEvents, unknownEvents);
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View file

@ -1,66 +0,0 @@
/* eventrep.h: Allocation replayer interface
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
*
* $Id$
*/
#ifndef eventrep_h
#define eventrep_h
#include "config.h"
/* override variety setting for EVENT */
#define EVENT
#include "eventcom.h"
#include "mpmtypes.h"
extern Res EventRepInit(Bool partial);
extern void EventRepFinish(void);
extern void EventReplay(Event event, Word etime);
#endif /* eventrep_h */
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View file

@ -37,9 +37,9 @@ static void check_allocated_size(mps_pool_t pool, size_t allocated)
/* stress -- create a pool of the requested type and allocate in it */
static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
size_t (*size)(size_t i), mps_align_t align,
const char *name, mps_pool_class_t pool_class,
mps_arg_s *args)
size_t (*size)(size_t i, mps_align_t align),
mps_align_t align, const char *name,
mps_pool_class_t pool_class, mps_arg_s *args)
{
mps_res_t res;
mps_pool_t pool;
@ -58,7 +58,7 @@ static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
/* allocate a load of objects */
for (i=0; i<testSetSIZE; ++i) {
mps_addr_t obj;
ss[i] = (*size)(i);
ss[i] = (*size)(i, align);
res = mps_alloc(&obj, pool, ss[i]);
if (res != MPS_RES_OK)
return res;
@ -84,7 +84,7 @@ static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
}
/* free half of the objects */
/* upper half, as when allocating them again we want smaller objects */
/* see randomSize() */
/* see randomSizeAligned() */
for (i=testSetSIZE/2; i<testSetSIZE; ++i) {
mps_free(pool, (mps_addr_t)ps[i], ss[i]);
/* if (i == testSetSIZE/2) */
@ -95,7 +95,7 @@ static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
/* allocate some new objects */
for (i=testSetSIZE/2; i<testSetSIZE; ++i) {
mps_addr_t obj;
ss[i] = (*size)(i);
ss[i] = (*size)(i, align);
res = mps_alloc(&obj, pool, ss[i]);
if (res != MPS_RES_OK)
return res;
@ -112,25 +112,13 @@ static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
}
/* randomSize -- produce sizes both large and small */
/* randomSizeAligned -- produce sizes both large and small */
static size_t randomSize(size_t i)
{
/* Make the range large enough to span three pages in the segment table: */
/* 160 segments/page, page size max 0x2000. */
size_t maxSize = 2 * 160 * 0x2000;
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */
return rnd() % max((maxSize >> (i / 10)), 2) + 1;
}
/* randomSize8 -- produce sizes both large and small, 8-byte aligned */
static size_t randomSize8(size_t i)
static size_t randomSizeAligned(size_t i, mps_align_t align)
{
size_t maxSize = 2 * 160 * 0x2000;
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */
return alignUp(rnd() % max((maxSize >> (i / 10)), 2) + 1, 8);
return alignUp(rnd() % max((maxSize >> (i / 10)), 2) + 1, align);
}
@ -138,9 +126,10 @@ static size_t randomSize8(size_t i)
static size_t fixedSizeSize = 0;
static size_t fixedSize(size_t i)
static size_t fixedSize(size_t i, mps_align_t align)
{
testlib_unused(i);
testlib_unused(align);
return fixedSizeSize;
}
@ -176,7 +165,7 @@ static void testInArena(mps_arena_class_t arena_class, size_t arena_grain_size,
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, TRUE);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, TRUE);
MPS_ARGS_ADD(args, MPS_KEY_SPARE, rnd_double());
die(stress(arena, NULL, randomSize8, align, "MVFF",
die(stress(arena, NULL, randomSizeAligned, align, "MVFF",
mps_class_mvff(), args), "stress MVFF");
} MPS_ARGS_END(args);
@ -188,25 +177,10 @@ static void testInArena(mps_arena_class_t arena_class, size_t arena_grain_size,
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, TRUE);
MPS_ARGS_ADD(args, MPS_KEY_SPARE, rnd_double());
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, options);
die(stress(arena, options, randomSize8, align, "MVFF debug",
die(stress(arena, options, randomSizeAligned, align, "MVFF debug",
mps_class_mvff_debug(), args), "stress MVFF debug");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
mps_align_t align = rnd_align(sizeof(void *), arena_grain_size);
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, align);
die(stress(arena, NULL, randomSize, align, "MV",
mps_class_mv(), args), "stress MV");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
mps_align_t align = sizeof(void *) << (rnd() % 4);
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, align);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, options);
die(stress(arena, options, randomSize, align, "MV debug",
mps_class_mv_debug(), args), "stress MV debug");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
fixedSizeSize = 1 + rnd() % 64;
MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, fixedSizeSize);

View file

@ -1,228 +0,0 @@
/* replay.c: Allocation replayer
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* $Id$
*/
#include "config.h"
/* override variety setting for EVENT */
#define EVENT
#include "eventcom.h"
#include "eventpro.h"
#include "eventrep.h"
#include "mpmtypes.h"
#include <stddef.h> /* for size_t */
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list */
#include <stdlib.h> /* for EXIT_FAILURE */
#include <string.h> /* for strcmp */
#include "mpstd.h"
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
#define PRIuLONGEST "llu"
#define PRIXPTR "016llX"
typedef unsigned long long ulongest_t;
#else
#define PRIuLONGEST "lu"
#define PRIXPTR "08lX"
typedef unsigned long ulongest_t;
#endif
typedef unsigned long ulong;
/* command-line arguments */
static char *prog; /* program name */
/* Globals */
static Word eventTime = 0; /* current event time */
/* error -- error signalling */
ATTRIBUTE_FORMAT((printf, 1, 2))
static void error(const char *format, ...)
{
va_list args;
fflush(stdout); /* sync */
fprintf(stderr, "%s: @%"PRIuLONGEST" ", prog, (ulongest_t)eventTime);
va_start(args, format);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
va_end(args);
exit(EXIT_FAILURE);
}
/* usage -- usage message */
static void usage(void)
{
fprintf(stderr,
"Usage: %s [-f logfile] [-p] [-?]\n"
"See guide.mps.telemetry for instructions.\n",
prog);
}
/* usageError -- explain usage and error */
static void usageError(void)
{
usage();
error("Bad usage");
}
/* parseArgs -- parse command line arguments, return log file name */
static char *parseArgs(int argc, char *argv[])
{
char *name = "mpsio.log";
int i = 1;
if (argc >= 1)
prog = argv[0];
else
prog = "unknown";
while (i < argc) { /* consider argument i */
if (argv[i][0] == '-') { /* it's an option argument */
switch (argv[i][1]) {
case 'f': /* file name */
++ i;
if (i == argc)
usageError();
else
name = argv[i];
break;
case '?': case 'h': /* help */
usage();
break;
default:
usageError();
}
} /* if option */
++ i;
}
return name;
}
/* readLog -- read and parse log */
static void readLog(EventProc proc)
{
while (TRUE) {
Event event;
Res res;
res = EventRead(&event, proc);
if (res == ResFAIL)
break; /* eof */
if (res != ResOK)
error("Truncated log");
eventTime = event->any.clock;
EventRecord(proc, event, eventTime);
EventReplay(event, eventTime);
EventDestroy(proc, event);
}
}
/* logReader -- reader function for a file log */
static FILE *input;
static Res logReader(void *file, void *p, size_t len)
{
size_t n;
n = fread(p, 1, len, (FILE *)file);
return (n < len) ? (feof((FILE *)file) ? ResFAIL : ResIO) : ResOK;
}
/* main */
int main(int argc, char *argv[])
{
char *filename;
EventProc proc;
Res res;
filename = parseArgs(argc,argv);
if (strcmp(filename, "-") == 0)
input = stdin;
else {
input = fopen(filename, "rb");
if (input == NULL)
error("unable to open \"%s\"\n", filename);
}
res = EventProcCreate(&proc, logReader, (void *)input);
if (res != ResOK)
error("Can't init EventProc module: error %d.", res);
res = EventRepInit();
if (res != ResOK)
error("Can't init EventRep module: error %d.", res);
readLog(proc);
EventRepFinish();
EventProcDestroy(proc);
return EXIT_SUCCESS;
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View file

@ -201,22 +201,6 @@ static void testInArena(mps_arena_class_t arena_class, mps_arg_s *arena_args)
"stress MVFF debug");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
mps_align_t align = rnd_align(sizeof(void *), arena_grain_size);
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, align);
die(stress(arena, align, randomSize, "MV", mps_class_mv(), args),
"stress MV");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
mps_align_t align = rnd_align(sizeof(void *), arena_grain_size);
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, align);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &debugOptions);
die(stress(arena, align, randomSize, "MV debug",
mps_class_mv_debug(), args),
"stress MV debug");
} MPS_ARGS_END(args);
MPS_ARGS_BEGIN(args) {
fixedSizeSize = MPS_PF_ALIGN * (1 + rnd() % 100);
MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, fixedSizeSize);

View file

@ -249,13 +249,10 @@ These files implement auxiliary programs. See
File Description
=========== ==================================================================
eventcnv.c :ref:`telemetry-mpseventcnv`.
eventrep.c Event replaying implementation (broken).
eventrep.h Event replaying interface (broken).
eventsql.c :ref:`telemetry-mpseventsql`.
eventtxt.c :ref:`telemetry-mpseventtxt`.
getopt.h Command-line option interface. Adapted from FreeBSD.
getoptl.c Command-line option implementation. Adapted from FreeBSD.
replay.c Event replaying program (broken).
table.c Address-based hash table implementation.
table.h Address-based hash table interface.
=========== ==================================================================

View file

@ -86,7 +86,7 @@ now :c:macro:`MPS_KEY_ARGS_END`.
Keyword Type & field in ``arg.val`` See
======================================== ========================================================= ==========================================================
:c:macro:`MPS_KEY_ARGS_END` *none* *see above*
:c:macro:`MPS_KEY_ALIGN` :c:type:`mps_align_t` ``align`` :c:func:`mps_class_mv`, :c:func:`mps_class_mvff`, :c:func:`mps_class_mvt`
:c:macro:`MPS_KEY_ALIGN` :c:type:`mps_align_t` ``align`` :c:func:`mps_class_mvff`, :c:func:`mps_class_mvt`
:c:macro:`MPS_KEY_AMS_SUPPORT_AMBIGUOUS` :c:type:`mps_bool_t` ``b`` :c:func:`mps_class_ams`
:c:macro:`MPS_KEY_ARENA_CL_BASE` :c:type:`mps_addr_t` ``addr`` :c:func:`mps_arena_class_cl`
:c:macro:`MPS_KEY_ARENA_GRAIN_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_arena_class_vm`, :c:func:`mps_arena_class_cl`
@ -94,7 +94,7 @@ now :c:macro:`MPS_KEY_ARGS_END`.
:c:macro:`MPS_KEY_AWL_FIND_DEPENDENT` ``void *(*)(void *)`` ``addr_method`` :c:func:`mps_class_awl`
:c:macro:`MPS_KEY_CHAIN` :c:type:`mps_chain_t` ``chain`` :c:func:`mps_class_amc`, :c:func:`mps_class_amcz`, :c:func:`mps_class_ams`, :c:func:`mps_class_awl`, :c:func:`mps_class_lo`
:c:macro:`MPS_KEY_COMMIT_LIMIT` :c:type:`size_t` ``size`` :c:func:`mps_arena_class_vm`, :c:func:`mps_arena_class_cl`
:c:macro:`MPS_KEY_EXTEND_BY` :c:type:`size_t` ``size`` :c:func:`mps_class_amc`, :c:func:`mps_class_amcz`, :c:func:`mps_class_mfs`, :c:func:`mps_class_mv`, :c:func:`mps_class_mvff`
:c:macro:`MPS_KEY_EXTEND_BY` :c:type:`size_t` ``size`` :c:func:`mps_class_amc`, :c:func:`mps_class_amcz`, :c:func:`mps_class_mfs`, :c:func:`mps_class_mvff`
:c:macro:`MPS_KEY_FMT_ALIGN` :c:type:`mps_align_t` ``align`` :c:func:`mps_fmt_create_k`
:c:macro:`MPS_KEY_FMT_CLASS` :c:type:`mps_fmt_class_t` ``fmt_class`` :c:func:`mps_fmt_create_k`
:c:macro:`MPS_KEY_FMT_FWD` :c:type:`mps_fmt_fwd_t` ``fmt_fwd`` :c:func:`mps_fmt_create_k`
@ -106,8 +106,7 @@ now :c:macro:`MPS_KEY_ARGS_END`.
:c:macro:`MPS_KEY_FORMAT` :c:type:`mps_fmt_t` ``format`` :c:func:`mps_class_amc`, :c:func:`mps_class_amcz`, :c:func:`mps_class_ams`, :c:func:`mps_class_awl`, :c:func:`mps_class_lo` , :c:func:`mps_class_snc`
:c:macro:`MPS_KEY_GEN` :c:type:`unsigned` ``u`` :c:func:`mps_class_ams`, :c:func:`mps_class_awl`, :c:func:`mps_class_lo`
:c:macro:`MPS_KEY_INTERIOR` :c:type:`mps_bool_t` ``b`` :c:func:`mps_class_amc`, :c:func:`mps_class_amcz`
:c:macro:`MPS_KEY_MAX_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_class_mv`
:c:macro:`MPS_KEY_MEAN_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_class_mv`, :c:func:`mps_class_mvt`, :c:func:`mps_class_mvff`
:c:macro:`MPS_KEY_MEAN_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_class_mvt`, :c:func:`mps_class_mvff`
:c:macro:`MPS_KEY_MFS_UNIT_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_class_mfs`
:c:macro:`MPS_KEY_MIN_SIZE` :c:type:`size_t` ``size`` :c:func:`mps_class_mvt`
:c:macro:`MPS_KEY_MVFF_ARENA_HIGH` :c:type:`mps_bool_t` ``b`` :c:func:`mps_class_mvff`

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = very large number as third argument to mps_alloc (MV)
summary = very large number as third argument to mps_alloc (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -11,7 +11,7 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void) {
mps_arena_t arena;
@ -20,8 +20,7 @@ static void test(void) {
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create");
cdie(mps_pool_create(&pool, arena, mps_class_mv(),
1024*32, 1024*16, 1024*256), "pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(mps_alloc(&q, pool, (size_t)-1 - mmqaArenaSIZE), "alloc");

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = high bit set 3rd arg to mps_alloc (MV)
summary = high bit set 3rd arg to mps_alloc (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -11,40 +11,27 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "arg.h"
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
mps_thr_t thread;
mps_addr_t a;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(
mps_pool_create(
&pool, arena, mps_class_mv(),
(size_t) 4096, (size_t) 32, (size_t) 64*1024),
"create pool");
die(mps_alloc(&a, pool, HIGHBIT_SIZE+8), "allocation failed (correct)");
die(mps_alloc(&a, pool, HIGHBIT_SIZE+8),
"allocation failed (correct)");
mps_pool_destroy(pool);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
return 0;
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = unaligned addr_t to free (MV)
summary = unaligned addr_t to free (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -12,41 +12,28 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "arg.h"
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
mps_thr_t thread;
mps_addr_t a;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(
mps_pool_create(
&pool, arena, mps_class_mv(),
(size_t) 4096, (size_t) 32, (size_t) 64*1024),
"create pool");
die(mps_alloc(&a, pool, 8),
"alloc");
die(mps_alloc(&a, pool, 8), "alloc");
mps_free(pool, (mps_addr_t) ((char *)a+1), 8);
mps_pool_destroy(pool);
mps_pool_destroy(pool);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
return 0;
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = wrong size_t to free (MV)
summary = wrong size_t to free (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -12,41 +12,28 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "arg.h"
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
mps_thr_t thread;
mps_addr_t a;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(
mps_pool_create(
&pool, arena, mps_class_mv(),
(size_t) 4096, (size_t) 32, (size_t) 64*1024),
"create pool");
die(mps_alloc(&a, pool, 8),
"alloc a");
die(mps_alloc(&a, pool, 8), "alloc a");
mps_free(pool, a, HIGHBIT_SIZE+8);
mps_pool_destroy(pool);
mps_pool_destroy(pool);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
return 0;
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = zero extendBy for pool_create (MV)
summary = zero extendBy for pool_create (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -12,36 +12,27 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "arg.h"
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
mps_thr_t thread;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(
&pool, arena, mps_class_mv(),
(size_t) 0, (size_t) 32, (size_t) 32),
"create pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, 0);
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "pool");
} MPS_ARGS_END(args);
mps_pool_destroy(pool);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
return 0;
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = zero avgSize for pool_create (MV)
summary = zero avgSize for pool_create (MVFF)
language = c
link = testlib.o
OUTPUT_SPEC
@ -12,11 +12,9 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "arg.h"
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
@ -24,11 +22,10 @@ static void test(void)
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(
&pool, arena, mps_class_mv(),
(size_t) 32, (size_t) 0, (size_t) 32),
"create pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, 0);
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "pool");
} MPS_ARGS_END(args);
mps_pool_destroy(pool);
mps_arena_destroy(arena);
@ -36,9 +33,6 @@ static void test(void)
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
return 0;
}

View file

@ -12,34 +12,17 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_arena_t arena = malloc(4096);
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
/* cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
*/
arena=malloc(4096);
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
mps_pool_destroy(pool);
comment("Destroyed pool.");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -10,29 +10,18 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
mps_arena_destroy(arena);
comment("Destroyed arena.");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
}
int main(void)

View file

@ -5,32 +5,20 @@ TEST_HEADER
language = c
link = testlib.o
OUTPUT_SPEC
abort = true
assert = true
assertfile P= mpsi.c
assertcond = TESTT(Pool, pool)
END_HEADER
*/
#include <stdlib.h>
#include "testlib.h"
#include "mpscmv.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool = (mps_pool_t)1;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
/*
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
*/
mps_pool_t pool = malloc(4096);
mps_pool_destroy(pool);
comment("Destroyed pool.");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -12,35 +12,20 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
mps_pool_destroy(pool);
comment("Destroyed pool.");
mps_pool_destroy(pool);
comment("Destroyed pool again.");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -5,36 +5,23 @@ TEST_HEADER
language = c
link = testlib.o
OUTPUT_SPEC
abort = true
assert = true
assertfile P= mpsi.c
assertcond = TESTT(Pool, pool)
END_HEADER
*/
#include <stdlib.h>
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool = (mps_pool_t)1;
mps_pool_t pool = malloc(4096);
mps_addr_t obj;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
/*
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
*/
cdie(mps_alloc(&obj, pool, 152), "allocate");
mps_pool_destroy(pool);
comment("Destroyed pool");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -12,36 +12,23 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
mps_addr_t obj;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
mps_pool_destroy(pool);
comment("Destroyed pool");
cdie(mps_alloc(&obj, pool, 152), "allocate");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -12,39 +12,25 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
mps_addr_t obj;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(mps_alloc(&obj, pool, 152), "allocate");
mps_pool_destroy(pool);
comment("Destroyed pool");
mps_free(pool, obj, 512);
comment("Freed.");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -11,40 +11,25 @@ OUTPUT_SPEC
END_HEADER
*/
#include <stdlib.h>
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
mps_addr_t obj = (mps_addr_t)MPS_PF_ALIGN;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
mps_addr_t obj = malloc(512);
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
/*
cdie(mps_alloc(&obj, pool, 152), "allocate");
*/
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
mps_free(pool, obj, 512);
comment("Freed.");
mps_pool_destroy(pool);
comment("Destroyed pool");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -1,53 +1,36 @@
/*
TEST_HEADER
id = $Id$
summary = free though not allocated
summary = double free
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertfile P= tract.c
assertcond = found
assertfile P= poolmvff.c
assertcond = res == ResOK
END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
mps_addr_t obj;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(mps_alloc(&obj, pool, 152), "allocate");
mps_free(pool, obj, 152);
comment("Freed.");
mps_free(pool, obj, 152);
comment("Freed again.");
mps_pool_destroy(pool);
comment("Destroyed pool");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -12,28 +12,29 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool0;
mps_pool_t pool1;
mps_pool_t pool0, pool1;
mps_addr_t obj;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_pool_create_k(&pool0, arena, mps_class_mv(), mps_args_none),
cdie(mps_pool_create_k(&pool0, arena, mps_class_mvff(), mps_args_none),
"create pool 0");
cdie(mps_pool_create_k(&pool1, arena, mps_class_mv(), mps_args_none),
cdie(mps_pool_create_k(&pool1, arena, mps_class_mvff(), mps_args_none),
"create pool 1");
cdie(mps_alloc(&obj, pool0, 152), "allocate in 0");
mps_free(pool1, obj, 512);
comment("Freed in 1.");
mps_pool_destroy(pool1);
mps_pool_destroy(pool0);
mps_arena_destroy(arena);
}
int main(void)

View file

@ -12,34 +12,28 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool0;
mps_pool_t pool1;
mps_pool_t pool0, pool1;
mps_addr_t obj;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(mps_pool_create_k(&pool0, arena, mps_class_mv(), mps_args_none),
cdie(mps_pool_create_k(&pool0, arena, mps_class_mvff(), mps_args_none),
"create pool 0");
cdie(mps_pool_create_k(&pool1, arena, mps_class_mv(), mps_args_none),
cdie(mps_pool_create_k(&pool1, arena, mps_class_mvff(), mps_args_none),
"create pool 1");
cdie(mps_alloc(&obj, pool0, 152), "allocate in 0");
mps_pool_destroy(pool1);
comment("Pool 1 destroyed.");
mps_free(pool1, obj, 512);
comment("Freed in 1.");
mps_pool_destroy(pool0);
comment("Pool 0 destroyed.");
mps_arena_destroy(arena);
}
int main(void)

View file

@ -12,28 +12,18 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
mps_arena_destroy(arena);
comment("Destroy arena.");
}
int main(void)

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = free though not allocated
summary = free with wrong size
language = c
link = testlib.o
OUTPUT_SPEC
@ -12,40 +12,24 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool;
size_t extendBy;
size_t avgSize;
size_t maxSize;
mps_addr_t obj;
extendBy = (size_t) 4096;
avgSize = (size_t) 32;
maxSize = (size_t) 65536;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
cdie(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
cdie(mps_alloc(&obj, pool, 152), "allocate");
cdie(mps_alloc(&obj, pool, 4), "alloc2");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
cdie(mps_alloc(&obj, pool, 152), "allocate");
mps_free(pool, obj, 512);
comment("Freed.");
mps_pool_destroy(pool);
comment("Destroyed pool");
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
int main(void)

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = MV functional tests allocate and free in manual variable pool
summary = MVFF allocate and free
language = c
link = testlib.o
END_HEADER
@ -9,7 +9,7 @@ END_HEADER
#include <time.h>
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#define MAXNUMBER 1000000
@ -54,7 +54,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val)
}
static void dt(int kind,
size_t extendBy, size_t avgSize, size_t maxSize,
size_t extendBy, size_t avgSize,
size_t mins, size_t maxs, int number, int iter)
{
mps_pool_t pool;
@ -68,10 +68,11 @@ static void dt(int kind,
time0 = clock();
asserts(time0 != -1, "processor time not available");
die(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, extendBy);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, avgSize);
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "pool");
} MPS_ARGS_END(args);
for(hd=0; hd<number; hd++)
{
@ -99,9 +100,9 @@ static void dt(int kind,
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, hd%256),
"corrupt at %x (%s: %x, %x, %x, %x, %x, %i, %i)",
"corrupt at %x (%s: %x, %x, %x, %x, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
tdesc[kind], (int) extendBy, (int) avgSize,
(int) mins, (int) maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
@ -124,8 +125,8 @@ static void dt(int kind,
time1=clock();
secs=(time1-time0)/(double)CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %x, %x, %i, %i) in %.2f s",
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
comment("%s test (%x, %x, %x, %x, %i, %i) in %.2f s",
tdesc[kind], (int) extendBy, (int) avgSize,
(int) mins, (int) maxs, number, iter, secs);
}
@ -139,26 +140,26 @@ static void test(void)
mins = sizeof(int);
dt(SEQ, 4096, 32, 64*1024, 8, 9, 5, 10);
dt(RANGAP, 64, 64, 64, 8, 128, 100, 1000);
dt(SEQ, 4096, 32, 8, 9, 5, 10);
dt(RANGAP, 64, 64, 8, 128, 100, 1000);
dt(DUMMY, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQ, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RAN, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RANGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(DUMMY, 4096, 32, 8, 64, 1000, 10000);
dt(SEQ, 4096, 32, 8, 64, 1000, 10000);
dt(RAN, 4096, 32, 8, 64, 1000, 10000);
dt(SEQGAP, 4096, 32, 8, 64, 1000, 10000);
dt(RANGAP, 4096, 32, 8, 64, 1000, 10000);
dt(DUMMY, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQ, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RAN, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RANGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(DUMMY, 4096, 1024, 100, 132, 1000, 10000);
dt(SEQ, 4096, 1024, 100, 132, 1000, 10000);
dt(RAN, 4096, 1024, 100, 132, 1000, 10000);
dt(SEQGAP, 4096, 1024, 100, 132, 1000, 10000);
dt(RANGAP, 4096, 1024, 100, 132, 1000, 10000);
dt(DUMMY, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(DUMMY, 128*1024, 64*1024, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, mins, 128*1024, 100, 10000);
mps_thread_dereg(thread);
mps_arena_destroy(arena);

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = more low memory tests with AMC (using MV)
summary = more low memory tests with AMC (using MVFF)
language = c
link = testlib.o rankfmt.o
END_HEADER
@ -9,7 +9,7 @@ END_HEADER
#include "testlib.h"
#include "mpscamc.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#include "rankfmt.h"
@ -22,7 +22,7 @@ static mps_gen_param_s testChain[genCOUNT] = {
void *stackpointer;
mps_pool_t poolmv;
mps_pool_t poolmvff;
mps_arena_t arena;
@ -32,12 +32,11 @@ static void fillup(void)
mps_addr_t a;
char *b;
die(mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)64, (size_t)64, (size_t)64),
"mps_pool_create");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"pool create");
size=1024ul*1024ul;
while (size) {
while (mps_alloc(&a, poolmv, size)==MPS_RES_OK) {
while (mps_alloc(&a, poolmvff, size)==MPS_RES_OK) {
for(b=a; b<(char *)a+size; b++) {
*b = 97;
}
@ -49,7 +48,7 @@ static void fillup(void)
static void empty(void)
{
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
}

View file

@ -21,7 +21,7 @@ END_HEADER
#include "testlib.h"
#include "mpsavm.h"
#include "mpscmv.h"
#include "mpscmvff.h"
void *stackpointer;
@ -59,7 +59,7 @@ static void test(void) {
/* create a pool */
cdie(mps_pool_create(&pool, arena, mps_class_mv(), (size_t) 64, (size_t) 64, (size_t) 64), "pool create");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
for (i=0; i<100; i++) {
die(mps_alloc(&a, pool, (size_t) 64), "alloc");
@ -109,7 +109,7 @@ static void test(void) {
i = 0;
while (i < sizeof pools / sizeof pools[0]) {
res = mps_pool_create(&pools[i], arena, mps_class_mv(), (size_t) 64, (size_t) 64, (size_t) 64);
res = mps_pool_create_k(&pools[i], arena, mps_class_mvff(), mps_args_none);
if (res == MPS_RES_OK) {
i++;
} else {

View file

@ -12,7 +12,7 @@ END_HEADER
#include "testlib.h"
#include "mpsavm.h"
#include "mpscmv.h"
#include "mpscmvff.h"
void *stackpointer;
@ -39,7 +39,7 @@ static void test(void) {
/* create a pool */
cdie(mps_pool_create(&pool, arena, mps_class_mv(), (size_t) 64, (size_t) 64, (size_t) 64), "pool create");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
for (i=0; i<200; i++) {
report("count", "%i", i);

View file

@ -12,7 +12,7 @@ END_HEADER
#include "testlib.h"
#include "mpsavm.h"
#include "mpscamc.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "newfmt.h"
@ -47,9 +47,7 @@ static void test(void)
die(mps_fmt_create_A(&format, arena, &fmtA), "create format");
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(1024*32), (size_t)(1024*16), (size_t)(1024*256)),
"create MV pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
do {
res = mps_alloc(&q, pool, 64*1024);

View file

@ -11,7 +11,7 @@ END_HEADER
#include "testlib.h"
#include "mpscamc.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#include "newfmt.h"
@ -48,9 +48,7 @@ static void test(void)
die(mps_fmt_create_A(&format, arena, &fmtA), "create format");
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(1024*32), (size_t)(1024*16), (size_t)(1024*256)),
"create MV pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
while (mps_alloc(&q, pool, 64*1024)==MPS_RES_OK);
p = 0;

View file

@ -11,7 +11,7 @@ END_HEADER
#include "testlib.h"
#include "mpscamc.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "newfmt.h"
void *stackpointer;
@ -32,9 +32,7 @@ static void test(void) {
die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, stackpointer, 0), "create root");
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(1024*32), (size_t)(1024*16), (size_t)(1024*256)),
"create MV pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
while (mps_alloc(&q, pool, 64*1024)==MPS_RES_OK);
p=0;

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = new MV allocation test
summary = new MVFF allocation test
language = c
link = testlib.o
parameters = ITERATIONS=10000
@ -10,7 +10,7 @@ END_HEADER
#include <time.h>
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
@ -56,7 +56,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val)
}
static void dt(int kind,
size_t extendBy, size_t avgSize, size_t maxSize,
size_t extendBy, size_t avgSize,
unsigned long mins, unsigned long maxs, int number, int iter)
{
mps_pool_t pool;
@ -70,10 +70,11 @@ static void dt(int kind,
time0 = clock();
asserts(time0 != -1, "processor time not available");
die(
mps_pool_create(&pool, arena, mps_class_mv(),
extendBy, avgSize, maxSize),
"create MV pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, extendBy);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, avgSize);
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "pool");
} MPS_ARGS_END(args);
for(hd=0; hd<number; hd++)
{
@ -101,9 +102,9 @@ static void dt(int kind,
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, (unsigned char) (hd%256)),
"corrupt at %x (%s: %x, %x, %x, %lx, %lx, %i, %i)",
"corrupt at %x (%s: %x, %x, %lx, %lx, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
tdesc[kind], (int) extendBy, (int) avgSize,
mins, maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
@ -126,8 +127,8 @@ static void dt(int kind,
time1=clock();
secs=(time1-time0)/(double)CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %lx, %lx, %i, %i) in %.2f s",
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
comment("%s test (%x, %x, %lx, %lx, %i, %i) in %.2f s",
tdesc[kind], (int) extendBy, (int) avgSize,
mins, maxs, number, iter, secs);
}
@ -141,26 +142,26 @@ static void test(void)
mins = sizeof(int);
dt(SEQ, 4096, 32, 64*1024, 8, 9, 5, ITERATIONS);
dt(RANGAP, 64, 64, 64, 8, 128, 100, ITERATIONS);
dt(SEQ, 4096, 32, 8, 9, 5, ITERATIONS);
dt(RANGAP, 64, 64, 8, 128, 100, ITERATIONS);
dt(DUMMY, 4096, 32, 64*1024, 8, 64, 1000, ITERATIONS);
dt(SEQ, 4096, 32, 64*1024, 8, 64, 1000, ITERATIONS);
dt(RAN, 4096, 32, 64*1024, 8, 64, 1000, ITERATIONS);
dt(SEQGAP, 4096, 32, 64*1024, 8, 64, 1000, ITERATIONS);
dt(RANGAP, 4096, 32, 64*1024, 8, 64, 1000, ITERATIONS);
dt(DUMMY, 4096, 32, 8, 64, 1000, ITERATIONS);
dt(SEQ, 4096, 32, 8, 64, 1000, ITERATIONS);
dt(RAN, 4096, 32, 8, 64, 1000, ITERATIONS);
dt(SEQGAP, 4096, 32, 8, 64, 1000, ITERATIONS);
dt(RANGAP, 4096, 32, 8, 64, 1000, ITERATIONS);
dt(DUMMY, 4096, 1024, 64*1024, 100, 132, 1000, ITERATIONS);
dt(SEQ, 4096, 1024, 64*1024, 100, 132, 1000, ITERATIONS);
dt(RAN, 4096, 1024, 64*1024, 100, 132, 1000, ITERATIONS);
dt(SEQGAP, 4096, 1024, 64*1024, 100, 132, 1000, ITERATIONS);
dt(RANGAP, 4096, 1024, 64*1024, 100, 132, 1000, ITERATIONS);
dt(DUMMY, 4096, 1024, 100, 132, 1000, ITERATIONS);
dt(SEQ, 4096, 1024, 100, 132, 1000, ITERATIONS);
dt(RAN, 4096, 1024, 100, 132, 1000, ITERATIONS);
dt(SEQGAP, 4096, 1024, 100, 132, 1000, ITERATIONS);
dt(RANGAP, 4096, 1024, 100, 132, 1000, ITERATIONS);
dt(DUMMY, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, ITERATIONS);
dt(SEQ, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, ITERATIONS);
dt(RAN, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, ITERATIONS);
dt(SEQGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, ITERATIONS);
dt(RANGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, ITERATIONS);
dt(DUMMY, 128*1024, 64*1024, mins, 128*1024, 100, ITERATIONS);
dt(SEQ, 128*1024, 64*1024, mins, 128*1024, 100, ITERATIONS);
dt(RAN, 128*1024, 64*1024, mins, 128*1024, 100, ITERATIONS);
dt(SEQGAP, 128*1024, 64*1024, mins, 128*1024, 100, ITERATIONS);
dt(RANGAP, 128*1024, 64*1024, mins, 128*1024, 100, ITERATIONS);
mps_thread_dereg(thread);
mps_arena_destroy(arena);

View file

@ -9,7 +9,7 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void) {
mps_arena_t arena;
@ -19,9 +19,7 @@ static void test(void) {
die(mps_arena_create_k(&arena, mps_arena_class_vm(), mps_args_none), "create");
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(32), (size_t)(16), (size_t)(256)),
"create MV pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
for (p=0; p<OBJECTS; p++) {
die(mps_alloc(&q, pool, 1024), "alloc");

View file

@ -9,7 +9,7 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
static void test(void) {
mps_arena_t arena;
@ -19,9 +19,7 @@ static void test(void) {
die(mps_arena_create_k(&arena, mps_arena_class_vm(), mps_args_none), "create");
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(32), (size_t)(16), (size_t)(256)),
"create MV pool");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
die(mps_alloc(&q, pool, 1024), "alloc");

View file

@ -11,7 +11,7 @@ END_HEADER
#include "testlib.h"
#include "mpscawl.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscamc.h"
#include "mpsavm.h"
#include "rankfmt.h"
@ -71,7 +71,7 @@ static void blat(mps_ap_t apamc, unsigned percent) {
}
static void test(void) {
mps_pool_t poolmv, poolawl, poolamc;
mps_pool_t poolmvff, poolawl, poolamc;
mps_thr_t thread;
mps_root_t root0, root1, root2;
mps_addr_t p;
@ -112,9 +112,8 @@ static void test(void) {
mps_pool_create(&poolawl, arena, mps_class_awl(), format, getassociated),
"create awl pool");
cdie(mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)0x4000, (size_t)128, (size_t)0x4000),
"create mv pool");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"create MVFF pool");
cdie(
mps_ap_create(&apawl, poolawl, mps_rank_exact()),
@ -135,9 +134,9 @@ static void test(void) {
*/
for (i=0; i < MAXLDS; i++) {
mps_alloc(&p, poolmv, sizeof(mps_ld_s));
mps_alloc(&p, poolmvff, sizeof(mps_ld_s));
lds[i] = (mps_ld_t) p;
mps_alloc(&p, poolmv, sizeof(mps_ld_s));
mps_alloc(&p, poolmvff, sizeof(mps_ld_s));
ldm[i] = (mps_ld_t) p;
}
@ -176,7 +175,7 @@ static void test(void) {
mps_ap_destroy(apamc);
comment("Destroyed aps.");
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
mps_pool_destroy(poolamc);
mps_pool_destroy(poolawl);
comment("Destroyed pools.");

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = ensure allocation in MV pool causes collection
summary = ensure allocation in MVFF pool causes collection
language = c
link = newfmt.o testlib.o
OUTPUT_SPEC
@ -14,7 +14,7 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscamc.h"
#include "mpsavm.h"
#include "newfmt.h"
@ -34,7 +34,7 @@ void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t poolMV, poolAMC;
mps_pool_t poolMVFF, poolAMC;
mps_thr_t thread;
mps_fmt_t format;
@ -67,33 +67,43 @@ static void test(void)
comment("Sizes in megabytes:");
die(mps_pool_create(&poolMV, arena, mps_class_mv(),
EXTEND_BY, MEAN_SIZE, MAX_SIZE),
"create MV pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND_BY);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, MEAN_SIZE);
cdie(mps_pool_create_k(&poolMVFF, arena, mps_class_mvff(), args),
"create MVFF pool");
} MPS_ARGS_END(args);
i = 0;
while ((r=mps_alloc(&p, poolMV, 1024*1024)) == 0) i++;
while ((r=mps_alloc(&p, poolMVFF, 1024*1024)) == 0) i++;
report("refuse1", "%s", err_text(r));
report("size1", "%i", i);
s1 = i;
mps_pool_destroy(poolMV);
mps_pool_destroy(poolMVFF);
die(mps_pool_create(&poolMV, arena, mps_class_mv(),
EXTEND_BY, MEAN_SIZE, MAX_SIZE),
"create MV pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND_BY);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, MEAN_SIZE);
cdie(mps_pool_create_k(&poolMVFF, arena, mps_class_mvff(), args),
"create MVFF pool");
} MPS_ARGS_END(args);
i = 0;
while ((r=mps_alloc(&p, poolMV, 1024*1024)) == 0) i++;
while ((r=mps_alloc(&p, poolMVFF, 1024*1024)) == 0) i++;
report("refuse2", "%s", err_text(r));
report("size2", "%i", i);
s2 = i;
mps_pool_destroy(poolMV);
mps_pool_destroy(poolMVFF);
a = allocdumb(ap, 1024*1024*30); /* allocate 30 M object */
die(mps_pool_create(&poolMV, arena, mps_class_mv(),
EXTEND_BY, MEAN_SIZE, MAX_SIZE),
"create MV pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND_BY);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, MEAN_SIZE);
cdie(mps_pool_create_k(&poolMVFF, arena, mps_class_mvff(), args),
"create MVFF pool");
} MPS_ARGS_END(args);
i=0;
while ((r=mps_alloc(&p, poolMV, 1024*1024)) == 0) i++;
while ((r=mps_alloc(&p, poolMVFF, 1024*1024)) == 0) i++;
report("refuse3", "%s", err_text(r));
report("size3", "%i", i);
s3 = i;
@ -102,12 +112,12 @@ static void test(void)
report("diff23", "%i", s2-s3);
for(i = 0; i < 10; i++) {
r = mps_alloc(&p, poolMV, 1024*1024);
r = mps_alloc(&p, poolMVFF, 1024*1024);
report("refuse4", "%s", err_text(r));
}
mps_arena_park(arena);
mps_pool_destroy(poolMV);
mps_pool_destroy(poolMVFF);
mps_ap_destroy(ap);

View file

@ -10,7 +10,7 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscmvff.h"
mps_arena_t arena;
mps_pool_t pool;
@ -19,9 +19,7 @@ mps_addr_t q;
static mps_res_t trysize(size_t try) {
mps_res_t res;
die(mps_pool_create(&pool, arena, mps_class_mv(),
(size_t)(1024*32), (size_t)(1024*16), (size_t)(1024*256)),
"pool_create");
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");
comment("Trying %x", try);

View file

@ -9,7 +9,7 @@ END_HEADER
#include "testlib.h"
#include "mpscawl.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscamc.h"
#include "mpsavm.h"
#include "rankfmt.h"
@ -52,7 +52,7 @@ static void checklds(void)
static void test(void)
{
mps_pool_t poolmv, poolawl, poolamc;
mps_pool_t poolmvff, poolawl, poolamc;
mps_thr_t thread;
mps_root_t root0, root1, root2;
@ -91,9 +91,8 @@ static void test(void)
cdie(mps_pool_create(&poolawl, arena, mps_class_awl(), format, getassociated),
"create awl pool");
cdie(mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)0x4000, (size_t)128, (size_t)0x4000),
"create mv pool");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"create MVFF pool");
cdie(mps_ap_create(&apawl, poolawl, mps_rank_exact()),
"create ap");
@ -105,7 +104,7 @@ static void test(void)
for (i=0; i < MAXLDS; i++) {
comment("%d", i);
mps_alloc(&p, poolmv, sizeof(mps_ld_s));
mps_alloc(&p, poolmvff, sizeof(mps_ld_s));
a = allocone(apawl, 5, mps_rank_exact());
setref(a, 0, b);
b = a;
@ -155,7 +154,7 @@ static void test(void)
mps_arena_park(arena);
mps_ap_destroy(apawl);
mps_ap_destroy(apamc);
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
mps_pool_destroy(poolamc);
mps_pool_destroy(poolawl);
comment("Destroyed pools.");

View file

@ -9,7 +9,7 @@ END_HEADER
#include "testlib.h"
#include "mpscawl.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscamc.h"
#include "mpsavm.h"
#include "rankfmt.h"
@ -22,7 +22,7 @@ void *stackpointer;
static void test(void) {
mps_arena_t arena;
mps_pool_t poolmv, poolawl;
mps_pool_t poolmvff, poolawl;
mps_thr_t thread;
mps_root_t root0, root1;
@ -54,9 +54,8 @@ static void test(void) {
cdie(mps_pool_create(&poolawl, arena, mps_class_awl(), format, getassociated),
"create awl pool");
cdie(mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)0x4000, (size_t)128, (size_t)0x4000),
"create mv pool");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"create MVFF pool");
cdie(mps_ap_create(&apawl, poolawl, mps_rank_exact()),
"create ap");
@ -65,7 +64,7 @@ static void test(void) {
for (i=0; i < MAXLDS; i++) {
comment("%d", i);
mps_alloc(&p, poolmv, sizeof(mps_ld_s));
mps_alloc(&p, poolmvff, sizeof(mps_ld_s));
a = allocone(apawl, 5, mps_rank_exact());
setref(a, 0, b);
b = a;
@ -92,7 +91,7 @@ static void test(void) {
mps_ap_destroy(apawl);
comment("Destroyed ap.");
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
mps_pool_destroy(poolawl);
comment("Destroyed pools.");

View file

@ -9,7 +9,7 @@ END_HEADER
#include "testlib.h"
#include "mpscawl.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpscamc.h"
#include "rankfmt.h"
@ -44,7 +44,7 @@ static void checklds(void) {
}
static void test(void) {
mps_pool_t poolmv, poolawl, poolamc;
mps_pool_t poolmvff, poolawl, poolamc;
mps_thr_t thread;
mps_root_t root0, root1, root2;
@ -89,10 +89,8 @@ static void test(void) {
mps_pool_create(&poolawl, arena, mps_class_awl(), format, getassociated),
"create awl pool");
cdie(
mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)0x4000, (size_t)128, (size_t)0x4000),
"create mv pool");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"create MVFF pool");
cdie(
mps_ap_create(&apawl, poolawl, mps_rank_exact()),
@ -116,7 +114,7 @@ static void test(void) {
for (i=0; i < MAXLDS; i++) {
comment("%d", i);
mps_alloc(&p, poolmv, sizeof(mps_ld_s));
mps_alloc(&p, poolmvff, sizeof(mps_ld_s));
a = allocone(apawl, 5, mps_rank_exact());
setref(a, 0, b);
b = a;
@ -161,7 +159,7 @@ static void test(void) {
mps_ap_destroy(apamc);
comment("Destroyed aps.");
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
mps_pool_destroy(poolamc);
mps_pool_destroy(poolawl);
comment("Destroyed pools.");

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = low memory tests with AMC (and using MV)
summary = low memory tests with AMC (and using MVFF)
language = c
link = testlib.o rankfmt.o
END_HEADER
@ -9,7 +9,7 @@ END_HEADER
#include "testlib.h"
#include "mpscamc.h"
#include "mpscmv.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#include "rankfmt.h"
@ -22,7 +22,7 @@ static mps_gen_param_s testChain[genCOUNT] = {
void *stackpointer;
mps_pool_t poolmv;
mps_pool_t poolmvff;
mps_arena_t arena;
@ -31,18 +31,17 @@ static void fillup(void)
size_t size;
mps_addr_t a;
die(mps_pool_create(&poolmv, arena, mps_class_mv(),
(size_t)64, (size_t)64, (size_t)64),
"create MV pool");
cdie(mps_pool_create_k(&poolmvff, arena, mps_class_mvff(), mps_args_none),
"create MVFF pool");
for (size=1024ul*1024ul; size >= 4096ul; size /= 2)
while (mps_alloc(&a, poolmv, size)==MPS_RES_OK)
while (mps_alloc(&a, poolmvff, size)==MPS_RES_OK)
;
}
static void empty(void)
{
mps_pool_destroy(poolmv);
mps_pool_destroy(poolmvff);
}

View file

@ -21,7 +21,7 @@ conerr/15.c
conerr/16.c
% conerr/17.c -- fails in hot variety (assertion is on the critical path)
conerr/18.c
conerr/19.c
% conerr/19.c -- assertion in different place in the hot variety
% conerr/20.c -- segfaults in hot variety (assertion is on the critical path)
% conerr/21.c -- segfaults in hot variety (assertion is on the critical path)
% conerr/22.c -- segfaults in hot variety (assertion is on the critical path)

View file

@ -10,6 +10,7 @@ argerr/31.c
argerr/33.c
argerr/35.c
argerr/37.c
conerr/19.c
conerr/26.c
% Rank is not a structure type, so AVERT(Rank) does nothing.