1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-19 01:10:57 -08:00

Test ambiguous internal pointers; fix objnull problem

Copied from Perforce
 Change: 19677
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Pekka Pirinen 1998-06-11 20:04:57 +01:00
parent ac2df7caa5
commit cd1386ecea

View file

@ -1,33 +1,33 @@
/* impl.c.amcss: POOL CLASS AMC STRESS TEST
*
* $HopeName: MMsrc!amcss.c(trunk.25) $
* Copyright (C) 1996, 1998 Harlequin Group, all rights reserved
* $HopeName: MMsrc!amcss.c(trunk.26) $
* Copyright (C) 1998. Harlequin Group plc. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "fmtdy.h"
#include "testlib.h"
#include "mps.h"
#include "mpscamc.h"
#include "mpsavm.h"
#include "fmtdy.h"
#include "mpstd.h"
#ifdef MPS_OS_W3
#include "mpsw3.h"
#endif
#include "mps.h"
#ifdef MPS_OS_SU
#include "ossu.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define testArenaSIZE ((size_t)64<<20)
#define exactRootsCOUNT 50
#define ambigRootsCOUNT 50
#define ambigRootsCOUNT 100
#define collectionsCOUNT 5
#define initTestFREQ 6000
/* objNULL needs to be odd so that it's ignored in exactRoots. */
#define objNULL ((mps_addr_t)0xDECEA5ED)
static mps_pool_t pool;
@ -88,14 +88,15 @@ static void *test(void *arg, size_t s)
for(i=0; i<ambigRootsCOUNT; ++i)
ambigRoots[i] = (mps_addr_t)rnd();
die(mps_root_create_table(&exactRoot, arena,
MPS_RANK_EXACT, (mps_rm_t)0,
&exactRoots[0], exactRootsCOUNT),
"root_create_table(exact)");
die(mps_root_create_table_masked(&exactRoot, arena,
MPS_RANK_EXACT, (mps_rm_t)0,
&exactRoots[0], exactRootsCOUNT,
(mps_word_t)1),
"root_create_table(exact)");
die(mps_root_create_table(&ambigRoot, arena,
MPS_RANK_AMBIG, (mps_rm_t)0,
&ambigRoots[0], ambigRootsCOUNT),
"root_create_table(ambig)");
"root_create_table(ambig)");
/* create an ap, and leave it busy */
die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy");
@ -129,6 +130,10 @@ static void *test(void *arg, size_t s)
else
ambigRoots[rnd() % ambigRootsCOUNT] = make();
/* Create random interior pointers */
r = rnd() % ambigRootsCOUNT;
ambigRoots[r] = (mps_addr_t)((char *)(ambigRoots[r/2]) + 1);
r = rnd() % exactRootsCOUNT;
if(exactRoots[r] != objNULL)
assert(dylan_check(exactRoots[r]));