aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorDavid Jones2003-07-29 16:56:26 +0100
committerDavid Jones2003-07-29 16:56:26 +0100
commited070474363c9506cbc966d9bdb6ccedf30ce9e0 (patch)
tree002437aa43aaff9d1682c0f278a6e70cf38744c2 /mps/code
parentacb4c41731e05e50d4a99fc7b3120577ff329988 (diff)
downloademacs-ed070474363c9506cbc966d9bdb6ccedf30ce9e0.tar.gz
emacs-ed070474363c9506cbc966d9bdb6ccedf30ce9e0.zip
Mps: check in my broken branch
Copied from Perforce Change: 51937 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/chain.h22
-rw-r--r--mps/code/config.h8
-rw-r--r--mps/code/locus.c24
3 files changed, 49 insertions, 5 deletions
diff --git a/mps/code/chain.h b/mps/code/chain.h
index d37a46ccde4..325b9e876ce 100644
--- a/mps/code/chain.h
+++ b/mps/code/chain.h
@@ -1,7 +1,7 @@
1/* chain.h: GENERATION CHAINS 1/* chain.h: GENERATION CHAINS
2 * 2 *
3 * $Id$ 3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. 4 * Copyright (c) 2001,2003 Ravenbrook Limited. See end of file for license.
5 */ 5 */
6 6
7#ifndef chain_h 7#ifndef chain_h
@@ -11,6 +11,22 @@
11#include "ring.h" 11#include "ring.h"
12 12
13 13
14/* PoolGenMessageStruct implements mps_message_type_gc_gen(). Embedded
15 in PoolGenStruct. */
16
17typedef struct PoolGenMessageStruct *PoolGenMessage;
18
19#define PoolGenMessageSig ((Sig)0x519B9359) /* SIGnature PoolGenMeSsaGe */
20
21typedef struct PoolGenMessageStruct {
22 Sig sig;
23 char id[POOL_GEN_MESSAGE_ID_LEN];
24 Size condemned; /* byte count */
25 /* Textual description of forwarding generation. */
26 char forward[POOL_GEN_MESSAGE_FORWARD_LEN];
27 MessageStruct messageStruct;
28}
29
14/* GenParamStruct -- structure for specifying generation parameters */ 30/* GenParamStruct -- structure for specifying generation parameters */
15/* .gen-param: This structure must match <code/mps.h#gen-param>. */ 31/* .gen-param: This structure must match <code/mps.h#gen-param>. */
16 32
@@ -35,7 +51,6 @@ typedef struct GenDescStruct {
35 RingStruct locusRing; /* Ring of all PoolGen's in this GenDesc (locus) */ 51 RingStruct locusRing; /* Ring of all PoolGen's in this GenDesc (locus) */
36} GenDescStruct; 52} GenDescStruct;
37 53
38
39/* PoolGen -- descriptor of a generation in a pool */ 54/* PoolGen -- descriptor of a generation in a pool */
40 55
41typedef struct PoolGenStruct *PoolGen; 56typedef struct PoolGenStruct *PoolGen;
@@ -51,6 +66,7 @@ typedef struct PoolGenStruct {
51 RingStruct genRing; 66 RingStruct genRing;
52 Size totalSize; /* total size of segs in gen in this pool */ 67 Size totalSize; /* total size of segs in gen in this pool */
53 Size newSize; /* size allocated since last GC */ 68 Size newSize; /* size allocated since last GC */
69 PoolGenMessageStruct message;
54} PoolGenStruct; 70} PoolGenStruct;
55 71
56 72
@@ -94,7 +110,7 @@ extern void PoolGenUpdateZones(PoolGen gen, Seg seg);
94 110
95/* C. COPYRIGHT AND LICENSE 111/* C. COPYRIGHT AND LICENSE
96 * 112 *
97 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. 113 * Copyright (C) 2001-2003 Ravenbrook Limited <http://www.ravenbrook.com/>.
98 * All rights reserved. This is an open source license. Contact 114 * All rights reserved. This is an open source license. Contact
99 * Ravenbrook for commercial licensing options. 115 * Ravenbrook for commercial licensing options.
100 * 116 *
diff --git a/mps/code/config.h b/mps/code/config.h
index c25b6c443c0..6afc19e48ad 100644
--- a/mps/code/config.h
+++ b/mps/code/config.h
@@ -203,6 +203,14 @@
203#define VMANPageALIGNMENT ((Align)4096) 203#define VMANPageALIGNMENT ((Align)4096)
204#define VMJunkBYTE ((unsigned char)0xA9) 204#define VMJunkBYTE ((unsigned char)0xA9)
205 205
206/* Pool Gen Configuration -- see <code/chain.h> */
207
208/* Length (in chars) of a char buffer used to store the id and
209 forwarding generation in the implementation of
210 mps_message_type_gc_gen(). */
211#define POOL_GEN_MESSAGE_ID_LEN 64
212#define POOL_GEN_MESSAGE_FORWARD_LEN 64
213
206 214
207/* Tracer Configuration -- see <code/trace.c> */ 215/* Tracer Configuration -- see <code/trace.c> */
208 216
diff --git a/mps/code/locus.c b/mps/code/locus.c
index 81972cc860e..42cfa48f099 100644
--- a/mps/code/locus.c
+++ b/mps/code/locus.c
@@ -361,6 +361,24 @@ void ChainEndGC(Chain chain, Trace trace)
361 chain->activeTraces = TraceSetDel(chain->activeTraces, trace); 361 chain->activeTraces = TraceSetDel(chain->activeTraces, trace);
362} 362}
363 363
364#define PoolGenMessageMessage(m) (&(m)->messageStruct)
365#define MessagePoolGenMessage(message) \
366 (PARENT(PoolGenMessageStruct, messageStruct, message))
367
368static void PoolGenMessageInit(PoolGenMessage message, PoolGen gen)
369{
370 size_t i = 0;
371 size_t l;
372 /* message is to be initialised so can't be checked. */
373 /* gen is halfway through intialisation. Naughtily, we will
374 use some of it but not check it. */
375
376 message->id[i++] = '[';
377 ClassOfPool(gen->pool);
378 mps_lib_memcpy(message->id,
379 message->condemned = 0;
380}
381
364 382
365/* PoolGenInit -- initialize a PoolGen */ 383/* PoolGenInit -- initialize a PoolGen */
366 384
@@ -377,13 +395,15 @@ Res PoolGenInit(PoolGen gen, Chain chain, Serial nr, Pool pool)
377 RingInit(&gen->genRing); 395 RingInit(&gen->genRing);
378 gen->totalSize = (Size)0; 396 gen->totalSize = (Size)0;
379 gen->newSize = (Size)0; 397 gen->newSize = (Size)0;
398 PoolGenMessageInit(&gen->messageStruct);
380 gen->sig = PoolGenSig; 399 gen->sig = PoolGenSig;
381 400
382 if (nr != chain->genCount) 401 if(nr != chain->genCount) {
383 RingAppend(&chain->gens[nr].locusRing, &gen->genRing); 402 RingAppend(&chain->gens[nr].locusRing, &gen->genRing);
384 else 403 } else {
385 /* Dynamic generation is linked to the arena, not the chain. */ 404 /* Dynamic generation is linked to the arena, not the chain. */
386 RingAppend(&chain->arena->topGen.locusRing, &gen->genRing); 405 RingAppend(&chain->arena->topGen.locusRing, &gen->genRing);
406 }
387 AVERT(PoolGen, gen); 407 AVERT(PoolGen, gen);
388 return ResOK; 408 return ResOK;
389} 409}