diff options
| author | Richard Kistruck | 2007-06-21 17:02:28 +0100 |
|---|---|---|
| committer | Richard Kistruck | 2007-06-21 17:02:28 +0100 |
| commit | 3d17eed32bda22692bea74bf3e1a43ae790bc818 (patch) | |
| tree | 00d5a80b91f32fd48c21aef53a56509a355b6c8a /mps/code/finalcv.c | |
| parent | 2b596882367f1b54262d9b5f88fcf8360216e609 (diff) | |
| download | emacs-3d17eed32bda22692bea74bf3e1a43ae790bc818.tar.gz emacs-3d17eed32bda22692bea74bf3e1a43ae790bc818.zip | |
mps br/diag finalcv: (clarify only) improve hash-def names and comments.
Copied from Perforce
Change: 162627
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code/finalcv.c')
| -rw-r--r-- | mps/code/finalcv.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/mps/code/finalcv.c b/mps/code/finalcv.c index cc7af27f9ac..8e5deaf0030 100644 --- a/mps/code/finalcv.c +++ b/mps/code/finalcv.c | |||
| @@ -37,7 +37,11 @@ | |||
| 37 | #define finalizationRATE 6 | 37 | #define finalizationRATE 6 |
| 38 | #define gcINTERVAL ((size_t)150 * 1024) | 38 | #define gcINTERVAL ((size_t)150 * 1024) |
| 39 | #define collectionCOUNT 3 | 39 | #define collectionCOUNT 3 |
| 40 | #define slotSIZE (3*sizeof(mps_word_t)) | 40 | |
| 41 | /* 3 words: wrapper | vector-len | first-slot */ | ||
| 42 | #define vectorSIZE (3*sizeof(mps_word_t)) | ||
| 43 | #define vectorSLOT 2 | ||
| 44 | |||
| 41 | #define genCOUNT 2 | 45 | #define genCOUNT 2 |
| 42 | 46 | ||
| 43 | /* testChain -- generation parameters for the test */ | 47 | /* testChain -- generation parameters for the test */ |
| @@ -100,6 +104,7 @@ static void *test(void *arg, size_t s) | |||
| 100 | mps_pool_t amc; | 104 | mps_pool_t amc; |
| 101 | mps_res_t e; | 105 | mps_res_t e; |
| 102 | mps_root_t mps_root[2]; | 106 | mps_root_t mps_root[2]; |
| 107 | mps_addr_t nullref = NULL; | ||
| 103 | int state[rootCOUNT]; | 108 | int state[rootCOUNT]; |
| 104 | mps_arena_t arena; | 109 | mps_arena_t arena; |
| 105 | void *p = NULL; | 110 | void *p = NULL; |
| @@ -121,18 +126,17 @@ static void *test(void *arg, size_t s) | |||
| 121 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create\n"); | 126 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create\n"); |
| 122 | 127 | ||
| 123 | /* Make registered-for-finalization objects. */ | 128 | /* Make registered-for-finalization objects. */ |
| 124 | /* .references-to-obj-0: Note that the first root ref (root[0]) is */ | ||
| 125 | /* passed to dylan_init each time, so the root[0] object (only) */ | ||
| 126 | /* may be referred to by other registered-for-finalization */ | ||
| 127 | /* objects. */ | ||
| 128 | /* <design/poolmrg/#test.promise.ut.alloc> */ | 129 | /* <design/poolmrg/#test.promise.ut.alloc> */ |
| 129 | for(i = 0; i < rootCOUNT; ++i) { | 130 | for(i = 0; i < rootCOUNT; ++i) { |
| 130 | do { | 131 | do { |
| 131 | MPS_RESERVE_BLOCK(e, p, ap, slotSIZE); | 132 | MPS_RESERVE_BLOCK(e, p, ap, vectorSIZE); |
| 132 | die(e, "MPS_RES_OK"); | 133 | die(e, "MPS_RES_OK"); |
| 133 | die(dylan_init(p, slotSIZE, root, 1), "dylan_init"); | 134 | die(dylan_init(p, vectorSIZE, &nullref, 1), "dylan_init"); |
| 134 | } while (!mps_commit(ap, p, slotSIZE)); | 135 | } while (!mps_commit(ap, p, vectorSIZE)); |
| 135 | ((mps_word_t *)p)[2] = dylan_int(i); | 136 | |
| 137 | /* store index in vector's slot */ | ||
| 138 | ((mps_word_t *)p)[vectorSLOT] = dylan_int(i); | ||
| 139 | |||
| 136 | die(mps_finalize(arena, &p), "finalize\n"); | 140 | die(mps_finalize(arena, &p), "finalize\n"); |
| 137 | root[i] = p; state[i] = rootSTATE; | 141 | root[i] = p; state[i] = rootSTATE; |
| 138 | } | 142 | } |
| @@ -160,10 +164,8 @@ static void *test(void *arg, size_t s) | |||
| 160 | /* ...expect it to be finalized soon */ | 164 | /* ...expect it to be finalized soon */ |
| 161 | state[i] = finalizableSTATE; | 165 | state[i] = finalizableSTATE; |
| 162 | } | 166 | } |
| 163 | /* Drop the root reference to it; this probably* makes it */ | 167 | /* Drop the root reference to it; this makes it */ |
| 164 | /* non-E-reachable: so either dead, or ready-to-finalize. */ | 168 | /* non-E-reachable: so either dead, or ready-to-finalize. */ |
| 165 | /* (*: the exception is the root[0] object, see */ | ||
| 166 | /* .references-to-obj-0.) */ | ||
| 167 | root[i] = NULL; | 169 | root[i] = NULL; |
| 168 | } | 170 | } |
| 169 | } | 171 | } |
| @@ -180,7 +182,7 @@ static void *test(void *arg, size_t s) | |||
| 180 | "get"); | 182 | "get"); |
| 181 | mps_message_finalization_ref(&objaddr, arena, message); | 183 | mps_message_finalization_ref(&objaddr, arena, message); |
| 182 | obj = objaddr; | 184 | obj = objaddr; |
| 183 | objind = dylan_int_int(obj[2]); | 185 | objind = dylan_int_int(obj[vectorSLOT]); |
| 184 | printf("Finalizing: object %lu at %p\n", objind, objaddr); | 186 | printf("Finalizing: object %lu at %p\n", objind, objaddr); |
| 185 | /* <design/poolmrg/#test.promise.ut.final.check> */ | 187 | /* <design/poolmrg/#test.promise.ut.final.check> */ |
| 186 | cdie(root[objind] == NULL, "finalized live"); | 188 | cdie(root[objind] == NULL, "finalized live"); |