diff options
| author | Richard Brooksby | 2012-09-07 12:58:57 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2012-09-07 12:58:57 +0100 |
| commit | 78d5f049f0e60bd0c903bc331c253f681d082cea (patch) | |
| tree | 2313698d481513796220f50377bdd911fff16bad /mps/code | |
| parent | e17fee98ea221678f40bae915dd32c91ccc71922 (diff) | |
| download | emacs-78d5f049f0e60bd0c903bc331c253f681d082cea.tar.gz emacs-78d5f049f0e60bd0c903bc331c253f681d082cea.zip | |
Eliminating type puns on scan states, location dependencies, and allocation points through the mps interface.
Now that we're recommending inlining with client code and optimising with -O2 or -O3, we can't afford any bug introduced by the strict aliasing rule.
Copied from Perforce
Change: 179322
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/amcss.c | 8 | ||||
| -rw-r--r-- | mps/code/amcsshe.c | 10 | ||||
| -rw-r--r-- | mps/code/amcssth.c | 10 | ||||
| -rw-r--r-- | mps/code/amsss.c | 8 | ||||
| -rw-r--r-- | mps/code/amssshe.c | 8 | ||||
| -rw-r--r-- | mps/code/apss.c | 2 | ||||
| -rw-r--r-- | mps/code/awlut.c | 10 | ||||
| -rw-r--r-- | mps/code/awluthe.c | 10 | ||||
| -rw-r--r-- | mps/code/awlutth.c | 10 | ||||
| -rw-r--r-- | mps/code/buffer.c | 172 | ||||
| -rw-r--r-- | mps/code/exposet0.c | 8 | ||||
| -rw-r--r-- | mps/code/expt825.c | 4 | ||||
| -rw-r--r-- | mps/code/finalcv.c | 6 | ||||
| -rw-r--r-- | mps/code/finaltest.c | 4 | ||||
| -rw-r--r-- | mps/code/ld.c | 38 | ||||
| -rw-r--r-- | mps/code/locv.c | 4 | ||||
| -rw-r--r-- | mps/code/mpm.h | 46 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 74 | ||||
| -rw-r--r-- | mps/code/mpmtypes.h | 4 | ||||
| -rw-r--r-- | mps/code/mps.h | 69 | ||||
| -rw-r--r-- | mps/code/mpsi.c | 257 | ||||
| -rw-r--r-- | mps/code/mpsicv.c | 10 | ||||
| -rw-r--r-- | mps/code/mv2test.c | 2 | ||||
| -rw-r--r-- | mps/code/poolamc.c | 8 | ||||
| -rw-r--r-- | mps/code/qs.c | 6 | ||||
| -rw-r--r-- | mps/code/segsmss.c | 10 | ||||
| -rw-r--r-- | mps/code/steptest.c | 6 | ||||
| -rw-r--r-- | mps/code/testlib.h | 2 | ||||
| -rw-r--r-- | mps/code/trace.c | 36 | ||||
| -rw-r--r-- | mps/code/walkt0.c | 4 | ||||
| -rw-r--r-- | mps/code/zcoll.c | 6 | ||||
| -rw-r--r-- | mps/code/zmess.c | 4 |
32 files changed, 379 insertions, 477 deletions
diff --git a/mps/code/amcss.c b/mps/code/amcss.c index a6b47bf1914..236713cdf12 100644 --- a/mps/code/amcss.c +++ b/mps/code/amcss.c | |||
| @@ -182,8 +182,8 @@ static void *test(void *arg, size_t s) | |||
| 182 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), | 182 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), |
| 183 | "pool_create(amc)"); | 183 | "pool_create(amc)"); |
| 184 | 184 | ||
| 185 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 185 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 186 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 186 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 187 | 187 | ||
| 188 | for(i = 0; i < exactRootsCOUNT; ++i) | 188 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 189 | exactRoots[i] = objNULL; | 189 | exactRoots[i] = objNULL; |
| @@ -191,12 +191,12 @@ static void *test(void *arg, size_t s) | |||
| 191 | ambigRoots[i] = rnd_addr(); | 191 | ambigRoots[i] = rnd_addr(); |
| 192 | 192 | ||
| 193 | die(mps_root_create_table_masked(&exactRoot, arena, | 193 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 194 | MPS_RANK_EXACT, (mps_rm_t)0, | 194 | mps_rank_exact(), (mps_rm_t)0, |
| 195 | &exactRoots[0], exactRootsCOUNT, | 195 | &exactRoots[0], exactRootsCOUNT, |
| 196 | (mps_word_t)1), | 196 | (mps_word_t)1), |
| 197 | "root_create_table(exact)"); | 197 | "root_create_table(exact)"); |
| 198 | die(mps_root_create_table(&ambigRoot, arena, | 198 | die(mps_root_create_table(&ambigRoot, arena, |
| 199 | MPS_RANK_AMBIG, (mps_rm_t)0, | 199 | mps_rank_ambig(), (mps_rm_t)0, |
| 200 | &ambigRoots[0], ambigRootsCOUNT), | 200 | &ambigRoots[0], ambigRootsCOUNT), |
| 201 | "root_create_table(ambig)"); | 201 | "root_create_table(ambig)"); |
| 202 | 202 | ||
diff --git a/mps/code/amcsshe.c b/mps/code/amcsshe.c index 646f6c4f90b..1b8d3696b88 100644 --- a/mps/code/amcsshe.c +++ b/mps/code/amcsshe.c | |||
| @@ -127,8 +127,8 @@ static void *test(void *arg, size_t s) | |||
| 127 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), | 127 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), |
| 128 | "pool_create(amc)"); | 128 | "pool_create(amc)"); |
| 129 | 129 | ||
| 130 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 130 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 131 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 131 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 132 | 132 | ||
| 133 | for(i = 0; i < exactRootsCOUNT; ++i) | 133 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 134 | exactRoots[i] = objNULL; | 134 | exactRoots[i] = objNULL; |
| @@ -136,16 +136,16 @@ static void *test(void *arg, size_t s) | |||
| 136 | ambigRoots[i] = rnd_addr(); | 136 | ambigRoots[i] = rnd_addr(); |
| 137 | 137 | ||
| 138 | die(mps_root_create_table_masked(&exactRoot, arena, | 138 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 139 | MPS_RANK_EXACT, (mps_rm_t)0, | 139 | mps_rank_exact(), (mps_rm_t)0, |
| 140 | &exactRoots[0], exactRootsCOUNT, | 140 | &exactRoots[0], exactRootsCOUNT, |
| 141 | (mps_word_t)1), | 141 | (mps_word_t)1), |
| 142 | "root_create_table(exact)"); | 142 | "root_create_table(exact)"); |
| 143 | die(mps_root_create_table(&ambigRoot, arena, | 143 | die(mps_root_create_table(&ambigRoot, arena, |
| 144 | MPS_RANK_AMBIG, (mps_rm_t)0, | 144 | mps_rank_ambig(), (mps_rm_t)0, |
| 145 | &ambigRoots[0], ambigRootsCOUNT), | 145 | &ambigRoots[0], ambigRootsCOUNT), |
| 146 | "root_create_table(ambig)"); | 146 | "root_create_table(ambig)"); |
| 147 | die(mps_root_create_table(&bogusRoot, arena, | 147 | die(mps_root_create_table(&bogusRoot, arena, |
| 148 | MPS_RANK_AMBIG, (mps_rm_t)0, | 148 | mps_rank_ambig(), (mps_rm_t)0, |
| 149 | &bogusRoots[0], bogusRootsCOUNT), | 149 | &bogusRoots[0], bogusRootsCOUNT), |
| 150 | "root_create_table(bogus)"); | 150 | "root_create_table(bogus)"); |
| 151 | 151 | ||
diff --git a/mps/code/amcssth.c b/mps/code/amcssth.c index 08597be51a4..81eb0ad9b0d 100644 --- a/mps/code/amcssth.c +++ b/mps/code/amcssth.c | |||
| @@ -133,12 +133,12 @@ static void init(void) | |||
| 133 | ambigRoots[i] = rnd_addr(); | 133 | ambigRoots[i] = rnd_addr(); |
| 134 | 134 | ||
| 135 | die(mps_root_create_table_masked(&exactRoot, arena, | 135 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 136 | MPS_RANK_EXACT, (mps_rm_t)0, | 136 | mps_rank_exact(), (mps_rm_t)0, |
| 137 | &exactRoots[0], exactRootsCOUNT, | 137 | &exactRoots[0], exactRootsCOUNT, |
| 138 | (mps_word_t)1), | 138 | (mps_word_t)1), |
| 139 | "root_create_table(exact)"); | 139 | "root_create_table(exact)"); |
| 140 | die(mps_root_create_table(&ambigRoot, arena, | 140 | die(mps_root_create_table(&ambigRoot, arena, |
| 141 | MPS_RANK_AMBIG, (mps_rm_t)0, | 141 | mps_rank_ambig(), (mps_rm_t)0, |
| 142 | &ambigRoots[0], ambigRootsCOUNT), | 142 | &ambigRoots[0], ambigRootsCOUNT), |
| 143 | "root_create_table(ambig)"); | 143 | "root_create_table(ambig)"); |
| 144 | } | 144 | } |
| @@ -196,8 +196,8 @@ static void *test(void *arg, size_t s) | |||
| 196 | arena = (mps_arena_t)arg; | 196 | arena = (mps_arena_t)arg; |
| 197 | (void)s; /* unused */ | 197 | (void)s; /* unused */ |
| 198 | 198 | ||
| 199 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 199 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 200 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 200 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 201 | 201 | ||
| 202 | /* create an ap, and leave it busy */ | 202 | /* create an ap, and leave it busy */ |
| 203 | die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy"); | 203 | die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy"); |
| @@ -281,7 +281,7 @@ static void *fooey2(void *arg, size_t s) | |||
| 281 | mps_ap_t ap; | 281 | mps_ap_t ap; |
| 282 | 282 | ||
| 283 | (void)arg; (void)s; /* unused */ | 283 | (void)arg; (void)s; /* unused */ |
| 284 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate(fooey)"); | 284 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate(fooey)"); |
| 285 | while(mps_collections(arena) < collectionsCOUNT) { | 285 | while(mps_collections(arena) < collectionsCOUNT) { |
| 286 | churn(ap); | 286 | churn(ap); |
| 287 | } | 287 | } |
diff --git a/mps/code/amsss.c b/mps/code/amsss.c index 956bd4f58a0..27d6d69d9a3 100644 --- a/mps/code/amsss.c +++ b/mps/code/amsss.c | |||
| @@ -126,8 +126,8 @@ static void *test(void *arg, size_t haveAmbigous) | |||
| 126 | 126 | ||
| 127 | pool = (mps_pool_t)arg; | 127 | pool = (mps_pool_t)arg; |
| 128 | 128 | ||
| 129 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 129 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 130 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 130 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 131 | 131 | ||
| 132 | for(i = 0; i < exactRootsCOUNT; ++i) | 132 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 133 | exactRoots[i] = objNULL; | 133 | exactRoots[i] = objNULL; |
| @@ -136,13 +136,13 @@ static void *test(void *arg, size_t haveAmbigous) | |||
| 136 | ambigRoots[i] = rnd_addr(); | 136 | ambigRoots[i] = rnd_addr(); |
| 137 | 137 | ||
| 138 | die(mps_root_create_table_masked(&exactRoot, arena, | 138 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 139 | MPS_RANK_EXACT, (mps_rm_t)0, | 139 | mps_rank_exact(), (mps_rm_t)0, |
| 140 | &exactRoots[0], exactRootsCOUNT, | 140 | &exactRoots[0], exactRootsCOUNT, |
| 141 | (mps_word_t)1), | 141 | (mps_word_t)1), |
| 142 | "root_create_table(exact)"); | 142 | "root_create_table(exact)"); |
| 143 | if (haveAmbigous) | 143 | if (haveAmbigous) |
| 144 | die(mps_root_create_table(&ambigRoot, arena, | 144 | die(mps_root_create_table(&ambigRoot, arena, |
| 145 | MPS_RANK_AMBIG, (mps_rm_t)0, | 145 | mps_rank_ambig(), (mps_rm_t)0, |
| 146 | &ambigRoots[0], ambigRootsCOUNT), | 146 | &ambigRoots[0], ambigRootsCOUNT), |
| 147 | "root_create_table(ambig)"); | 147 | "root_create_table(ambig)"); |
| 148 | 148 | ||
diff --git a/mps/code/amssshe.c b/mps/code/amssshe.c index cc37010fe20..5457c13ee25 100644 --- a/mps/code/amssshe.c +++ b/mps/code/amssshe.c | |||
| @@ -83,8 +83,8 @@ static void *test(void *arg, size_t s) | |||
| 83 | die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, | 83 | die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, |
| 84 | TRUE), "pool_create(ams)"); | 84 | TRUE), "pool_create(ams)"); |
| 85 | 85 | ||
| 86 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 86 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 87 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 87 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 88 | 88 | ||
| 89 | for(i = 0; i < exactRootsCOUNT; ++i) | 89 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 90 | exactRoots[i] = objNULL; | 90 | exactRoots[i] = objNULL; |
| @@ -92,12 +92,12 @@ static void *test(void *arg, size_t s) | |||
| 92 | ambigRoots[i] = rnd_addr(); | 92 | ambigRoots[i] = rnd_addr(); |
| 93 | 93 | ||
| 94 | die(mps_root_create_table_masked(&exactRoot, arena, | 94 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 95 | MPS_RANK_EXACT, (mps_rm_t)0, | 95 | mps_rank_exact(), (mps_rm_t)0, |
| 96 | &exactRoots[0], exactRootsCOUNT, | 96 | &exactRoots[0], exactRootsCOUNT, |
| 97 | (mps_word_t)1), | 97 | (mps_word_t)1), |
| 98 | "root_create_table(exact)"); | 98 | "root_create_table(exact)"); |
| 99 | die(mps_root_create_table(&ambigRoot, arena, | 99 | die(mps_root_create_table(&ambigRoot, arena, |
| 100 | MPS_RANK_AMBIG, (mps_rm_t)0, | 100 | mps_rank_ambig(), (mps_rm_t)0, |
| 101 | &ambigRoots[0], ambigRootsCOUNT), | 101 | &ambigRoots[0], ambigRootsCOUNT), |
| 102 | "root_create_table(ambig)"); | 102 | "root_create_table(ambig)"); |
| 103 | 103 | ||
diff --git a/mps/code/apss.c b/mps/code/apss.c index 7b6472a5099..e23aee22f24 100644 --- a/mps/code/apss.c +++ b/mps/code/apss.c | |||
| @@ -57,7 +57,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i), | |||
| 57 | if (res != MPS_RES_OK) | 57 | if (res != MPS_RES_OK) |
| 58 | return res; | 58 | return res; |
| 59 | 59 | ||
| 60 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 60 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 61 | 61 | ||
| 62 | /* allocate a load of objects */ | 62 | /* allocate a load of objects */ |
| 63 | for (i=0; i<testSetSIZE; ++i) { | 63 | for (i=0; i<testSetSIZE; ++i) { |
diff --git a/mps/code/awlut.c b/mps/code/awlut.c index 965fb4642a0..74f566639d3 100644 --- a/mps/code/awlut.c +++ b/mps/code/awlut.c | |||
| @@ -257,7 +257,7 @@ static void *setup(void *v, size_t s) | |||
| 257 | arena = guff->arena; | 257 | arena = guff->arena; |
| 258 | thr = guff->thr; | 258 | thr = guff->thr; |
| 259 | 259 | ||
| 260 | die(mps_root_create_reg(&stack, arena, MPS_RANK_AMBIG, 0, thr, | 260 | die(mps_root_create_reg(&stack, arena, mps_rank_ambig(), 0, thr, |
| 261 | mps_stack_scan_ambig, v, 0), | 261 | mps_stack_scan_ambig, v, 0), |
| 262 | "Root Create\n"); | 262 | "Root Create\n"); |
| 263 | die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()), | 263 | die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()), |
| @@ -269,13 +269,13 @@ static void *setup(void *v, size_t s) | |||
| 269 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, | 269 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, |
| 270 | dylan_weak_dependent), | 270 | dylan_weak_dependent), |
| 271 | "Table Pool Create\n"); | 271 | "Table Pool Create\n"); |
| 272 | die(mps_ap_create(&leafap, leafpool, MPS_RANK_EXACT), | 272 | die(mps_ap_create(&leafap, leafpool, mps_rank_exact()), |
| 273 | "Leaf AP Create\n"); | 273 | "Leaf AP Create\n"); |
| 274 | die(mps_ap_create(&exactap, tablepool, MPS_RANK_EXACT), | 274 | die(mps_ap_create(&exactap, tablepool, mps_rank_exact()), |
| 275 | "Exact AP Create\n"); | 275 | "Exact AP Create\n"); |
| 276 | die(mps_ap_create(&weakap, tablepool, MPS_RANK_WEAK), | 276 | die(mps_ap_create(&weakap, tablepool, mps_rank_weak()), |
| 277 | "Weak AP Create\n"); | 277 | "Weak AP Create\n"); |
| 278 | die(mps_ap_create(&bogusap, tablepool, MPS_RANK_EXACT), | 278 | die(mps_ap_create(&bogusap, tablepool, mps_rank_exact()), |
| 279 | "Bogus AP Create\n"); | 279 | "Bogus AP Create\n"); |
| 280 | 280 | ||
| 281 | test(leafap, exactap, weakap, bogusap); | 281 | test(leafap, exactap, weakap, bogusap); |
diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c index 4b8d96df371..ea08a3bdef7 100644 --- a/mps/code/awluthe.c +++ b/mps/code/awluthe.c | |||
| @@ -262,7 +262,7 @@ static void *setup(void *v, size_t s) | |||
| 262 | arena = guff->arena; | 262 | arena = guff->arena; |
| 263 | thr = guff->thr; | 263 | thr = guff->thr; |
| 264 | 264 | ||
| 265 | die(mps_root_create_reg(&stack, arena, MPS_RANK_AMBIG, 0, thr, | 265 | die(mps_root_create_reg(&stack, arena, mps_rank_ambig(), 0, thr, |
| 266 | mps_stack_scan_ambig, v, 0), | 266 | mps_stack_scan_ambig, v, 0), |
| 267 | "Root Create\n"); | 267 | "Root Create\n"); |
| 268 | EnsureHeaderFormat(&dylanfmt, arena); | 268 | EnsureHeaderFormat(&dylanfmt, arena); |
| @@ -272,13 +272,13 @@ static void *setup(void *v, size_t s) | |||
| 272 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, | 272 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, |
| 273 | dylan_weak_dependent), | 273 | dylan_weak_dependent), |
| 274 | "Table Pool Create\n"); | 274 | "Table Pool Create\n"); |
| 275 | die(mps_ap_create(&leafap, leafpool, MPS_RANK_EXACT), | 275 | die(mps_ap_create(&leafap, leafpool, mps_rank_exact()), |
| 276 | "Leaf AP Create\n"); | 276 | "Leaf AP Create\n"); |
| 277 | die(mps_ap_create(&exactap, tablepool, MPS_RANK_EXACT), | 277 | die(mps_ap_create(&exactap, tablepool, mps_rank_exact()), |
| 278 | "Exact AP Create\n"); | 278 | "Exact AP Create\n"); |
| 279 | die(mps_ap_create(&weakap, tablepool, MPS_RANK_WEAK), | 279 | die(mps_ap_create(&weakap, tablepool, mps_rank_weak()), |
| 280 | "Weak AP Create\n"); | 280 | "Weak AP Create\n"); |
| 281 | die(mps_ap_create(&bogusap, tablepool, MPS_RANK_EXACT), | 281 | die(mps_ap_create(&bogusap, tablepool, mps_rank_exact()), |
| 282 | "Bogus AP Create\n"); | 282 | "Bogus AP Create\n"); |
| 283 | 283 | ||
| 284 | test(leafap, exactap, weakap, bogusap); | 284 | test(leafap, exactap, weakap, bogusap); |
diff --git a/mps/code/awlutth.c b/mps/code/awlutth.c index 26ef8c2c70d..3a5c9ee0fb1 100644 --- a/mps/code/awlutth.c +++ b/mps/code/awlutth.c | |||
| @@ -255,7 +255,7 @@ static void *setup(void *v, size_t s) | |||
| 255 | arena = guff->arena; | 255 | arena = guff->arena; |
| 256 | thr = guff->thr; | 256 | thr = guff->thr; |
| 257 | 257 | ||
| 258 | die(mps_root_create_reg(&stack, arena, MPS_RANK_AMBIG, 0, thr, | 258 | die(mps_root_create_reg(&stack, arena, mps_rank_ambig(), 0, thr, |
| 259 | mps_stack_scan_ambig, v, 0), | 259 | mps_stack_scan_ambig, v, 0), |
| 260 | "Root Create\n"); | 260 | "Root Create\n"); |
| 261 | die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()), | 261 | die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()), |
| @@ -267,13 +267,13 @@ static void *setup(void *v, size_t s) | |||
| 267 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, | 267 | die(mps_pool_create(&tablepool, arena, mps_class_awl(), dylanweakfmt, |
| 268 | dylan_weak_dependent), | 268 | dylan_weak_dependent), |
| 269 | "Table Pool Create\n"); | 269 | "Table Pool Create\n"); |
| 270 | die(mps_ap_create(&leafap, leafpool, MPS_RANK_EXACT), | 270 | die(mps_ap_create(&leafap, leafpool, mps_rank_exact()), |
| 271 | "Leaf AP Create\n"); | 271 | "Leaf AP Create\n"); |
| 272 | die(mps_ap_create(&exactap, tablepool, MPS_RANK_EXACT), | 272 | die(mps_ap_create(&exactap, tablepool, mps_rank_exact()), |
| 273 | "Exact AP Create\n"); | 273 | "Exact AP Create\n"); |
| 274 | die(mps_ap_create(&weakap, tablepool, MPS_RANK_WEAK), | 274 | die(mps_ap_create(&weakap, tablepool, mps_rank_weak()), |
| 275 | "Weak AP Create\n"); | 275 | "Weak AP Create\n"); |
| 276 | die(mps_ap_create(&bogusap, tablepool, MPS_RANK_EXACT), | 276 | die(mps_ap_create(&bogusap, tablepool, mps_rank_exact()), |
| 277 | "Bogus AP Create\n"); | 277 | "Bogus AP Create\n"); |
| 278 | 278 | ||
| 279 | test(leafap, exactap, weakap, bogusap); | 279 | test(leafap, exactap, weakap, bogusap); |
diff --git a/mps/code/buffer.c b/mps/code/buffer.c index f446ab5b9a0..b33c08dc239 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c | |||
| @@ -51,14 +51,14 @@ Bool BufferCheck(Buffer buffer) | |||
| 51 | CHECKL(buffer->emptySize <= buffer->fillSize); | 51 | CHECKL(buffer->emptySize <= buffer->fillSize); |
| 52 | CHECKL(buffer->alignment == buffer->pool->alignment); | 52 | CHECKL(buffer->alignment == buffer->pool->alignment); |
| 53 | CHECKL(AlignCheck(buffer->alignment)); | 53 | CHECKL(AlignCheck(buffer->alignment)); |
| 54 | CHECKL(BoolCheck(buffer->apStruct.enabled)); | 54 | CHECKL(BoolCheck(buffer->ap_s._enabled)); |
| 55 | 55 | ||
| 56 | if (buffer->apStruct.enabled) { | 56 | if (buffer->ap_s._enabled) { |
| 57 | /* no useful check for frameptr - mutator may be updating it */ | 57 | /* no useful check for frameptr - mutator may be updating it */ |
| 58 | CHECKL(BoolCheck(buffer->apStruct.lwPopPending)); | 58 | CHECKL(BoolCheck(buffer->ap_s._lwpoppending)); |
| 59 | } else { | 59 | } else { |
| 60 | CHECKL(buffer->apStruct.lwPopPending == FALSE); | 60 | CHECKL(buffer->ap_s._lwpoppending == FALSE); |
| 61 | CHECKL(buffer->apStruct.frameptr == NULL); | 61 | CHECKL(buffer->ap_s._frameptr == NULL); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /* If any of the buffer's fields indicate that it is reset, make */ | 64 | /* If any of the buffer's fields indicate that it is reset, make */ |
| @@ -68,15 +68,15 @@ Bool BufferCheck(Buffer buffer) | |||
| 68 | /* nothing to check */ | 68 | /* nothing to check */ |
| 69 | } else if ((buffer->mode & BufferModeATTACHED) == 0 | 69 | } else if ((buffer->mode & BufferModeATTACHED) == 0 |
| 70 | || buffer->base == (Addr)0 | 70 | || buffer->base == (Addr)0 |
| 71 | || buffer->apStruct.init == (Addr)0 | 71 | || buffer->ap_s.init == (Addr)0 |
| 72 | || buffer->apStruct.alloc == (Addr)0 | 72 | || buffer->ap_s.alloc == (Addr)0 |
| 73 | || buffer->poolLimit == (Addr)0) { | 73 | || buffer->poolLimit == (Addr)0) { |
| 74 | CHECKL((buffer->mode & BufferModeATTACHED) == 0); | 74 | CHECKL((buffer->mode & BufferModeATTACHED) == 0); |
| 75 | CHECKL(buffer->base == (Addr)0); | 75 | CHECKL(buffer->base == (Addr)0); |
| 76 | CHECKL(buffer->initAtFlip == (Addr)0); | 76 | CHECKL(buffer->initAtFlip == (Addr)0); |
| 77 | CHECKL(buffer->apStruct.init == (Addr)0); | 77 | CHECKL(buffer->ap_s.init == (Addr)0); |
| 78 | CHECKL(buffer->apStruct.alloc == (Addr)0); | 78 | CHECKL(buffer->ap_s.alloc == (Addr)0); |
| 79 | CHECKL(buffer->apStruct.limit == (Addr)0); | 79 | CHECKL(buffer->ap_s.limit == (Addr)0); |
| 80 | /* Nothing reliable to check for lightweight frame state */ | 80 | /* Nothing reliable to check for lightweight frame state */ |
| 81 | CHECKL(buffer->poolLimit == (Addr)0); | 81 | CHECKL(buffer->poolLimit == (Addr)0); |
| 82 | } else { | 82 | } else { |
| @@ -88,16 +88,16 @@ Bool BufferCheck(Buffer buffer) | |||
| 88 | 88 | ||
| 89 | /* These fields should obey the ordering */ | 89 | /* These fields should obey the ordering */ |
| 90 | /* base <= init <= alloc <= poolLimit */ | 90 | /* base <= init <= alloc <= poolLimit */ |
| 91 | CHECKL(buffer->base <= buffer->apStruct.init); | 91 | CHECKL((mps_addr_t)buffer->base <= buffer->ap_s.init); |
| 92 | CHECKL(buffer->apStruct.init <= buffer->apStruct.alloc); | 92 | CHECKL(buffer->ap_s.init <= buffer->ap_s.alloc); |
| 93 | CHECKL(buffer->apStruct.alloc <= buffer->poolLimit); | 93 | CHECKL(buffer->ap_s.alloc <= (mps_addr_t)buffer->poolLimit); |
| 94 | 94 | ||
| 95 | /* Check that the fields are aligned to the buffer alignment. */ | 95 | /* Check that the fields are aligned to the buffer alignment. */ |
| 96 | CHECKL(AddrIsAligned(buffer->base, buffer->alignment)); | 96 | CHECKL(AddrIsAligned(buffer->base, buffer->alignment)); |
| 97 | CHECKL(AddrIsAligned(buffer->initAtFlip, buffer->alignment)); | 97 | CHECKL(AddrIsAligned(buffer->initAtFlip, buffer->alignment)); |
| 98 | CHECKL(AddrIsAligned(buffer->apStruct.init, buffer->alignment)); | 98 | CHECKL(AddrIsAligned(buffer->ap_s.init, buffer->alignment)); |
| 99 | CHECKL(AddrIsAligned(buffer->apStruct.alloc, buffer->alignment)); | 99 | CHECKL(AddrIsAligned(buffer->ap_s.alloc, buffer->alignment)); |
| 100 | CHECKL(AddrIsAligned(buffer->apStruct.limit, buffer->alignment)); | 100 | CHECKL(AddrIsAligned(buffer->ap_s.limit, buffer->alignment)); |
| 101 | CHECKL(AddrIsAligned(buffer->poolLimit, buffer->alignment)); | 101 | CHECKL(AddrIsAligned(buffer->poolLimit, buffer->alignment)); |
| 102 | 102 | ||
| 103 | /* .lwcheck: If LW frames are enabled, the buffer may become */ | 103 | /* .lwcheck: If LW frames are enabled, the buffer may become */ |
| @@ -106,7 +106,7 @@ Bool BufferCheck(Buffer buffer) | |||
| 106 | /* Read a snapshot value of the limit field. Use this to determine */ | 106 | /* Read a snapshot value of the limit field. Use this to determine */ |
| 107 | /* if we are trapped, and to permit more useful checking when not */ | 107 | /* if we are trapped, and to permit more useful checking when not */ |
| 108 | /* yet trapped. */ | 108 | /* yet trapped. */ |
| 109 | aplimit = buffer->apStruct.limit; | 109 | aplimit = buffer->ap_s.limit; |
| 110 | 110 | ||
| 111 | /* If the buffer isn't trapped then "limit" should be the limit */ | 111 | /* If the buffer isn't trapped then "limit" should be the limit */ |
| 112 | /* set by the owning pool. Otherwise, "init" is either at the */ | 112 | /* set by the owning pool. Otherwise, "init" is either at the */ |
| @@ -117,17 +117,17 @@ Bool BufferCheck(Buffer buffer) | |||
| 117 | /* is kept at zero to avoid misuse (see */ | 117 | /* is kept at zero to avoid misuse (see */ |
| 118 | /* request.dylan.170429.sol.zero). */ | 118 | /* request.dylan.170429.sol.zero). */ |
| 119 | 119 | ||
| 120 | if ((buffer->apStruct.enabled && aplimit == (Addr)0) /* see .lwcheck */ | 120 | if ((buffer->ap_s._enabled && aplimit == (Addr)0) /* see .lwcheck */ |
| 121 | || (!buffer->apStruct.enabled && BufferIsTrapped(buffer))) { | 121 | || (!buffer->ap_s._enabled && BufferIsTrapped(buffer))) { |
| 122 | /* .check.use-trapped: This checking function uses BufferIsTrapped, */ | 122 | /* .check.use-trapped: This checking function uses BufferIsTrapped, */ |
| 123 | /* So BufferIsTrapped can't do checking as that would cause an */ | 123 | /* So BufferIsTrapped can't do checking as that would cause an */ |
| 124 | /* infinite loop. */ | 124 | /* infinite loop. */ |
| 125 | CHECKL(aplimit == (Addr)0); | 125 | CHECKL(aplimit == (Addr)0); |
| 126 | if (buffer->mode & BufferModeFLIPPED) { | 126 | if (buffer->mode & BufferModeFLIPPED) { |
| 127 | CHECKL(buffer->apStruct.init == buffer->initAtFlip | 127 | CHECKL(buffer->ap_s.init == buffer->initAtFlip |
| 128 | || buffer->apStruct.init == buffer->apStruct.alloc); | 128 | || buffer->ap_s.init == buffer->ap_s.alloc); |
| 129 | CHECKL(buffer->base <= buffer->initAtFlip); | 129 | CHECKL(buffer->base <= buffer->initAtFlip); |
| 130 | CHECKL(buffer->initAtFlip <= buffer->apStruct.init); | 130 | CHECKL(buffer->initAtFlip <= (Addr)buffer->ap_s.init); |
| 131 | } | 131 | } |
| 132 | /* Nothing special to check in the logged mode. */ | 132 | /* Nothing special to check in the logged mode. */ |
| 133 | } else { | 133 | } else { |
| @@ -174,9 +174,9 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream) | |||
| 174 | " alignment $W\n", (WriteFW)buffer->alignment, | 174 | " alignment $W\n", (WriteFW)buffer->alignment, |
| 175 | " base $A\n", buffer->base, | 175 | " base $A\n", buffer->base, |
| 176 | " initAtFlip $A\n", buffer->initAtFlip, | 176 | " initAtFlip $A\n", buffer->initAtFlip, |
| 177 | " init $A\n", buffer->apStruct.init, | 177 | " init $A\n", buffer->ap_s.init, |
| 178 | " alloc $A\n", buffer->apStruct.alloc, | 178 | " alloc $A\n", buffer->ap_s.alloc, |
| 179 | " limit $A\n", buffer->apStruct.limit, | 179 | " limit $A\n", buffer->ap_s.limit, |
| 180 | " poolLimit $A\n", buffer->poolLimit, | 180 | " poolLimit $A\n", buffer->poolLimit, |
| 181 | NULL); | 181 | NULL); |
| 182 | if (res != ResOK) return res; | 182 | if (res != ResOK) return res; |
| @@ -223,12 +223,15 @@ static Res BufferInitV(Buffer buffer, BufferClass class, | |||
| 223 | buffer->alignment = pool->alignment; /* .trans.mod */ | 223 | buffer->alignment = pool->alignment; /* .trans.mod */ |
| 224 | buffer->base = (Addr)0; | 224 | buffer->base = (Addr)0; |
| 225 | buffer->initAtFlip = (Addr)0; | 225 | buffer->initAtFlip = (Addr)0; |
| 226 | buffer->apStruct.init = (Addr)0; | 226 | /* In the next three assignements we really mean zero, not NULL, because |
| 227 | buffer->apStruct.alloc = (Addr)0; | 227 | the bit pattern is compared. It's pretty unlikely we'll encounter |
| 228 | buffer->apStruct.limit = (Addr)0; | 228 | a platform where this makes a difference. */ |
| 229 | buffer->apStruct.frameptr = NULL; | 229 | buffer->ap_s.init = (mps_addr_t)0; |
| 230 | buffer->apStruct.enabled = FALSE; | 230 | buffer->ap_s.alloc = (mps_addr_t)0; |
| 231 | buffer->apStruct.lwPopPending = FALSE; | 231 | buffer->ap_s.limit = (mps_addr_t)0; |
| 232 | buffer->ap_s._frameptr = NULL; | ||
| 233 | buffer->ap_s._enabled = FALSE; | ||
| 234 | buffer->ap_s._lwpoppending = FALSE; | ||
| 232 | buffer->poolLimit = (Addr)0; | 235 | buffer->poolLimit = (Addr)0; |
| 233 | buffer->rampCount = 0; | 236 | buffer->rampCount = 0; |
| 234 | 237 | ||
| @@ -327,7 +330,7 @@ void BufferDetach(Buffer buffer, Pool pool) | |||
| 327 | Size spare; | 330 | Size spare; |
| 328 | 331 | ||
| 329 | buffer->mode |= BufferModeTRANSITION; | 332 | buffer->mode |= BufferModeTRANSITION; |
| 330 | init = buffer->apStruct.init; | 333 | init = buffer->ap_s.init; |
| 331 | limit = buffer->poolLimit; | 334 | limit = buffer->poolLimit; |
| 332 | /* Ask the owning pool to do whatever it needs to before the */ | 335 | /* Ask the owning pool to do whatever it needs to before the */ |
| 333 | /* buffer is detached (e.g. copy buffer state into pool state). */ | 336 | /* buffer is detached (e.g. copy buffer state into pool state). */ |
| @@ -353,9 +356,9 @@ void BufferDetach(Buffer buffer, Pool pool) | |||
| 353 | /* Reset the buffer. */ | 356 | /* Reset the buffer. */ |
| 354 | buffer->base = (Addr)0; | 357 | buffer->base = (Addr)0; |
| 355 | buffer->initAtFlip = (Addr)0; | 358 | buffer->initAtFlip = (Addr)0; |
| 356 | buffer->apStruct.init = (Addr)0; | 359 | buffer->ap_s.init = (mps_addr_t)0; |
| 357 | buffer->apStruct.alloc = (Addr)0; | 360 | buffer->ap_s.alloc = (mps_addr_t)0; |
| 358 | buffer->apStruct.limit = (Addr)0; | 361 | buffer->ap_s.limit = (mps_addr_t)0; |
| 359 | buffer->poolLimit = (Addr)0; | 362 | buffer->poolLimit = (Addr)0; |
| 360 | buffer->mode &= | 363 | buffer->mode &= |
| 361 | ~(BufferModeATTACHED|BufferModeFLIPPED|BufferModeTRANSITION); | 364 | ~(BufferModeATTACHED|BufferModeFLIPPED|BufferModeTRANSITION); |
| @@ -445,7 +448,7 @@ Bool BufferIsReady(Buffer buffer) | |||
| 445 | { | 448 | { |
| 446 | AVERT(Buffer, buffer); | 449 | AVERT(Buffer, buffer); |
| 447 | 450 | ||
| 448 | return buffer->apStruct.init == buffer->apStruct.alloc; | 451 | return buffer->ap_s.init == buffer->ap_s.alloc; |
| 449 | } | 452 | } |
| 450 | 453 | ||
| 451 | 454 | ||
| @@ -470,9 +473,9 @@ static void BufferSetUnflipped(Buffer buffer) | |||
| 470 | AVERT(Buffer, buffer); | 473 | AVERT(Buffer, buffer); |
| 471 | AVER(buffer->mode & BufferModeFLIPPED); | 474 | AVER(buffer->mode & BufferModeFLIPPED); |
| 472 | buffer->mode &= ~BufferModeFLIPPED; | 475 | buffer->mode &= ~BufferModeFLIPPED; |
| 473 | /* restore apStruct.limit if appropriate */ | 476 | /* restore ap_s.limit if appropriate */ |
| 474 | if (!BufferIsTrapped(buffer)) { | 477 | if (!BufferIsTrapped(buffer)) { |
| 475 | buffer->apStruct.limit = buffer->poolLimit; | 478 | buffer->ap_s.limit = buffer->poolLimit; |
| 476 | } | 479 | } |
| 477 | buffer->initAtFlip = (Addr)0; | 480 | buffer->initAtFlip = (Addr)0; |
| 478 | } | 481 | } |
| @@ -486,16 +489,16 @@ static void BufferSetUnflipped(Buffer buffer) | |||
| 486 | FrameState BufferFrameState(Buffer buffer) | 489 | FrameState BufferFrameState(Buffer buffer) |
| 487 | { | 490 | { |
| 488 | AVERT(Buffer, buffer); | 491 | AVERT(Buffer, buffer); |
| 489 | if (buffer->apStruct.enabled) { | 492 | if (buffer->ap_s._enabled) { |
| 490 | if (buffer->apStruct.lwPopPending) { | 493 | if (buffer->ap_s._lwpoppending) { |
| 491 | return BufferFramePOP_PENDING; | 494 | return BufferFramePOP_PENDING; |
| 492 | } else { | 495 | } else { |
| 493 | AVER(buffer->apStruct.frameptr == NULL); | 496 | AVER(buffer->ap_s._frameptr == NULL); |
| 494 | return BufferFrameVALID; | 497 | return BufferFrameVALID; |
| 495 | } | 498 | } |
| 496 | } else { | 499 | } else { |
| 497 | AVER(buffer->apStruct.frameptr == NULL); | 500 | AVER(buffer->ap_s._frameptr == NULL); |
| 498 | AVER(buffer->apStruct.lwPopPending == FALSE); | 501 | AVER(buffer->ap_s._lwpoppending == FALSE); |
| 499 | return BufferFrameDISABLED; | 502 | return BufferFrameDISABLED; |
| 500 | } | 503 | } |
| 501 | } | 504 | } |
| @@ -510,9 +513,9 @@ void BufferFrameSetState(Buffer buffer, FrameState state) | |||
| 510 | { | 513 | { |
| 511 | AVERT(Buffer, buffer); | 514 | AVERT(Buffer, buffer); |
| 512 | AVER(state == BufferFrameVALID || state == BufferFrameDISABLED); | 515 | AVER(state == BufferFrameVALID || state == BufferFrameDISABLED); |
| 513 | buffer->apStruct.frameptr = NULL; | 516 | buffer->ap_s._frameptr = NULL; |
| 514 | buffer->apStruct.lwPopPending = FALSE; | 517 | buffer->ap_s._lwpoppending = FALSE; |
| 515 | buffer->apStruct.enabled = (state == BufferFrameVALID); | 518 | buffer->ap_s._enabled = (state == BufferFrameVALID); |
| 516 | } | 519 | } |
| 517 | 520 | ||
| 518 | 521 | ||
| @@ -528,8 +531,8 @@ void BufferSetAllocAddr(Buffer buffer, Addr addr) | |||
| 528 | AVER(buffer->base <= addr); | 531 | AVER(buffer->base <= addr); |
| 529 | AVER(buffer->poolLimit >= addr); | 532 | AVER(buffer->poolLimit >= addr); |
| 530 | 533 | ||
| 531 | buffer->apStruct.init = addr; | 534 | buffer->ap_s.init = addr; |
| 532 | buffer->apStruct.alloc = addr; | 535 | buffer->ap_s.alloc = addr; |
| 533 | } | 536 | } |
| 534 | 537 | ||
| 535 | 538 | ||
| @@ -545,13 +548,13 @@ static void BufferFrameNotifyPopPending(Buffer buffer) | |||
| 545 | Pool pool; | 548 | Pool pool; |
| 546 | AVER(BufferIsTrappedByMutator(buffer)); | 549 | AVER(BufferIsTrappedByMutator(buffer)); |
| 547 | AVER(BufferFrameState(buffer) == BufferFramePOP_PENDING); | 550 | AVER(BufferFrameState(buffer) == BufferFramePOP_PENDING); |
| 548 | frame = (AllocFrame)buffer->apStruct.frameptr; | 551 | frame = (AllocFrame)buffer->ap_s._frameptr; |
| 549 | /* Unset PopPending state & notify the pool */ | 552 | /* Unset PopPending state & notify the pool */ |
| 550 | BufferFrameSetState(buffer, BufferFrameVALID); | 553 | BufferFrameSetState(buffer, BufferFrameVALID); |
| 551 | /* If the frame is no longer trapped, undo the trap by resetting */ | 554 | /* If the frame is no longer trapped, undo the trap by resetting */ |
| 552 | /* the AP limit pointer */ | 555 | /* the AP limit pointer */ |
| 553 | if (!BufferIsTrapped(buffer)) { | 556 | if (!BufferIsTrapped(buffer)) { |
| 554 | buffer->apStruct.limit = buffer->poolLimit; | 557 | buffer->ap_s.limit = buffer->poolLimit; |
| 555 | } | 558 | } |
| 556 | pool = BufferPool(buffer); | 559 | pool = BufferPool(buffer); |
| 557 | (*pool->class->framePopPending)(pool, buffer, frame); | 560 | (*pool->class->framePopPending)(pool, buffer, frame); |
| @@ -571,7 +574,7 @@ Res BufferFramePush(AllocFrame *frameReturn, Buffer buffer) | |||
| 571 | 574 | ||
| 572 | 575 | ||
| 573 | /* Process any flip or PopPending */ | 576 | /* Process any flip or PopPending */ |
| 574 | if (!BufferIsReset(buffer) && buffer->apStruct.limit == (Addr)0) { | 577 | if (!BufferIsReset(buffer) && buffer->ap_s.limit == (Addr)0) { |
| 575 | /* .fill.unflip: If the buffer is flipped then we unflip the buffer. */ | 578 | /* .fill.unflip: If the buffer is flipped then we unflip the buffer. */ |
| 576 | if (buffer->mode & BufferModeFLIPPED) { | 579 | if (buffer->mode & BufferModeFLIPPED) { |
| 577 | BufferSetUnflipped(buffer); | 580 | BufferSetUnflipped(buffer); |
| @@ -622,10 +625,11 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size, | |||
| 622 | /* Is there enough room in the unallocated portion of the buffer to */ | 625 | /* Is there enough room in the unallocated portion of the buffer to */ |
| 623 | /* satisfy the request? If so, just increase the alloc marker and */ | 626 | /* satisfy the request? If so, just increase the alloc marker and */ |
| 624 | /* return a pointer to the area below it. */ | 627 | /* return a pointer to the area below it. */ |
| 625 | next = AddrAdd(buffer->apStruct.alloc, size); | 628 | next = AddrAdd(buffer->ap_s.alloc, size); |
| 626 | if (next > buffer->apStruct.alloc && next <= buffer->apStruct.limit) { | 629 | if (next > (Addr)buffer->ap_s.alloc && |
| 627 | buffer->apStruct.alloc = next; | 630 | next <= (Addr)buffer->ap_s.limit) { |
| 628 | *pReturn = buffer->apStruct.init; | 631 | buffer->ap_s.alloc = next; |
| 632 | *pReturn = buffer->ap_s.init; | ||
| 629 | return ResOK; | 633 | return ResOK; |
| 630 | } | 634 | } |
| 631 | 635 | ||
| @@ -653,13 +657,13 @@ void BufferAttach(Buffer buffer, Addr base, Addr limit, | |||
| 653 | /* Set up the buffer to point at the supplied region */ | 657 | /* Set up the buffer to point at the supplied region */ |
| 654 | buffer->mode |= BufferModeATTACHED; | 658 | buffer->mode |= BufferModeATTACHED; |
| 655 | buffer->base = base; | 659 | buffer->base = base; |
| 656 | buffer->apStruct.init = init; | 660 | buffer->ap_s.init = init; |
| 657 | buffer->apStruct.alloc = AddrAdd(init, size); | 661 | buffer->ap_s.alloc = AddrAdd(init, size); |
| 658 | /* only set limit if not logged */ | 662 | /* only set limit if not logged */ |
| 659 | if ((buffer->mode & BufferModeLOGGED) == 0) { | 663 | if ((buffer->mode & BufferModeLOGGED) == 0) { |
| 660 | buffer->apStruct.limit = limit; | 664 | buffer->ap_s.limit = limit; |
| 661 | } else { | 665 | } else { |
| 662 | AVER(buffer->apStruct.limit == (Addr)0); | 666 | AVER(buffer->ap_s.limit == (Addr)0); |
| 663 | } | 667 | } |
| 664 | AVER(buffer->initAtFlip == (Addr)0); | 668 | AVER(buffer->initAtFlip == (Addr)0); |
| 665 | buffer->poolLimit = limit; | 669 | buffer->poolLimit = limit; |
| @@ -710,7 +714,7 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size, | |||
| 710 | 714 | ||
| 711 | /* If we're here because the buffer was trapped, then we attempt */ | 715 | /* If we're here because the buffer was trapped, then we attempt */ |
| 712 | /* the allocation here. */ | 716 | /* the allocation here. */ |
| 713 | if (!BufferIsReset(buffer) && buffer->apStruct.limit == (Addr)0) { | 717 | if (!BufferIsReset(buffer) && buffer->ap_s.limit == (Addr)0) { |
| 714 | /* .fill.unflip: If the buffer is flipped then we unflip the buffer. */ | 718 | /* .fill.unflip: If the buffer is flipped then we unflip the buffer. */ |
| 715 | if (buffer->mode & BufferModeFLIPPED) { | 719 | if (buffer->mode & BufferModeFLIPPED) { |
| 716 | BufferSetUnflipped(buffer); | 720 | BufferSetUnflipped(buffer); |
| @@ -722,21 +726,21 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size, | |||
| 722 | } | 726 | } |
| 723 | 727 | ||
| 724 | /* .fill.logged: If the buffer is logged then we leave it logged. */ | 728 | /* .fill.logged: If the buffer is logged then we leave it logged. */ |
| 725 | next = AddrAdd(buffer->apStruct.alloc, size); | 729 | next = AddrAdd(buffer->ap_s.alloc, size); |
| 726 | if (next > buffer->apStruct.alloc && | 730 | if (next > (Addr)buffer->ap_s.alloc && |
| 727 | next <= buffer->poolLimit) { | 731 | next <= (Addr)buffer->poolLimit) { |
| 728 | buffer->apStruct.alloc = next; | 732 | buffer->ap_s.alloc = next; |
| 729 | if (buffer->mode & BufferModeLOGGED) { | 733 | if (buffer->mode & BufferModeLOGGED) { |
| 730 | EVENT3(BufferReserve, buffer, buffer->apStruct.init, size); | 734 | EVENT3(BufferReserve, buffer, buffer->ap_s.init, size); |
| 731 | } | 735 | } |
| 732 | *pReturn = buffer->apStruct.init; | 736 | *pReturn = buffer->ap_s.init; |
| 733 | return ResOK; | 737 | return ResOK; |
| 734 | } | 738 | } |
| 735 | } | 739 | } |
| 736 | 740 | ||
| 737 | /* There really isn't enough room for the allocation now. */ | 741 | /* There really isn't enough room for the allocation now. */ |
| 738 | AVER(AddrAdd(buffer->apStruct.alloc, size) > buffer->poolLimit | 742 | AVER(AddrAdd(buffer->ap_s.alloc, size) > buffer->poolLimit || |
| 739 | || AddrAdd(buffer->apStruct.alloc, size) < buffer->apStruct.alloc); | 743 | AddrAdd(buffer->ap_s.alloc, size) < (Addr)buffer->ap_s.alloc); |
| 740 | 744 | ||
| 741 | BufferDetach(buffer, pool); | 745 | BufferDetach(buffer, pool); |
| 742 | 746 | ||
| @@ -752,7 +756,7 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size, | |||
| 752 | BufferAttach(buffer, base, limit, base, size); | 756 | BufferAttach(buffer, base, limit, base, size); |
| 753 | 757 | ||
| 754 | if (buffer->mode & BufferModeLOGGED) { | 758 | if (buffer->mode & BufferModeLOGGED) { |
| 755 | EVENT3(BufferReserve, buffer, buffer->apStruct.init, size); | 759 | EVENT3(BufferReserve, buffer, buffer->ap_s.init, size); |
| 756 | } | 760 | } |
| 757 | 761 | ||
| 758 | *pReturn = base; | 762 | *pReturn = base; |
| @@ -776,13 +780,13 @@ Bool BufferCommit(Buffer buffer, Addr p, Size size) | |||
| 776 | /* .commit.before: If a flip occurs before this point, when the */ | 780 | /* .commit.before: If a flip occurs before this point, when the */ |
| 777 | /* pool reads "initAtFlip" it will point below the object, so it */ | 781 | /* pool reads "initAtFlip" it will point below the object, so it */ |
| 778 | /* will be trashed and the commit must fail when trip is called. */ | 782 | /* will be trashed and the commit must fail when trip is called. */ |
| 779 | AVER(p == buffer->apStruct.init); | 783 | AVER(p == buffer->ap_s.init); |
| 780 | AVER(AddrAdd(buffer->apStruct.init, size) == buffer->apStruct.alloc); | 784 | AVER(AddrAdd(buffer->ap_s.init, size) == buffer->ap_s.alloc); |
| 781 | 785 | ||
| 782 | /* .commit.update: Atomically update the init pointer to declare */ | 786 | /* .commit.update: Atomically update the init pointer to declare */ |
| 783 | /* that the object is initialized (though it may be invalid if a */ | 787 | /* that the object is initialized (though it may be invalid if a */ |
| 784 | /* flip occurred). */ | 788 | /* flip occurred). */ |
| 785 | buffer->apStruct.init = buffer->apStruct.alloc; | 789 | buffer->ap_s.init = buffer->ap_s.alloc; |
| 786 | 790 | ||
| 787 | /* .improve.memory-barrier: Memory barrier here on the DEC Alpha */ | 791 | /* .improve.memory-barrier: Memory barrier here on the DEC Alpha */ |
| 788 | /* (and other relaxed memory order architectures). */ | 792 | /* (and other relaxed memory order architectures). */ |
| @@ -791,7 +795,7 @@ Bool BufferCommit(Buffer buffer, Addr p, Size size) | |||
| 791 | /* be collected. The commit must succeed when trip is called. */ | 795 | /* be collected. The commit must succeed when trip is called. */ |
| 792 | /* The pointer "p" will have been fixed up. (@@@@ Will it?) */ | 796 | /* The pointer "p" will have been fixed up. (@@@@ Will it?) */ |
| 793 | /* .commit.trip: Trip the buffer if a flip has occurred. */ | 797 | /* .commit.trip: Trip the buffer if a flip has occurred. */ |
| 794 | if (buffer->apStruct.limit == 0) | 798 | if (buffer->ap_s.limit == 0) |
| 795 | return BufferTrip(buffer, p, size); | 799 | return BufferTrip(buffer, p, size); |
| 796 | 800 | ||
| 797 | /* No flip occurred, so succeed. */ | 801 | /* No flip occurred, so succeed. */ |
| @@ -817,7 +821,7 @@ Bool BufferTrip(Buffer buffer, Addr p, Size size) | |||
| 817 | 821 | ||
| 818 | /* The limit field should be zero, because that's how trip gets */ | 822 | /* The limit field should be zero, because that's how trip gets */ |
| 819 | /* called. See .commit.trip. */ | 823 | /* called. See .commit.trip. */ |
| 820 | AVER(buffer->apStruct.limit == 0); | 824 | AVER(buffer->ap_s.limit == 0); |
| 821 | /* Of course we should be trapped. */ | 825 | /* Of course we should be trapped. */ |
| 822 | AVER(BufferIsTrapped(buffer)); | 826 | AVER(BufferIsTrapped(buffer)); |
| 823 | /* But the mutator shouldn't have caused the trap */ | 827 | /* But the mutator shouldn't have caused the trap */ |
| @@ -825,7 +829,7 @@ Bool BufferTrip(Buffer buffer, Addr p, Size size) | |||
| 825 | 829 | ||
| 826 | /* The init and alloc fields should be equal at this point, because */ | 830 | /* The init and alloc fields should be equal at this point, because */ |
| 827 | /* the step .commit.update has happened. */ | 831 | /* the step .commit.update has happened. */ |
| 828 | AVER(buffer->apStruct.init == buffer->apStruct.alloc); | 832 | AVER(buffer->ap_s.init == buffer->ap_s.alloc); |
| 829 | 833 | ||
| 830 | /* The p parameter points at the base address of the allocated */ | 834 | /* The p parameter points at the base address of the allocated */ |
| 831 | /* block, the end of which should now coincide with the init and */ | 835 | /* block, the end of which should now coincide with the init and */ |
| @@ -835,7 +839,7 @@ Bool BufferTrip(Buffer buffer, Addr p, Size size) | |||
| 835 | /* it seems like the algorithms could be modified to cope with the */ | 839 | /* it seems like the algorithms could be modified to cope with the */ |
| 836 | /* case of the object having been copied between Commit updating i */ | 840 | /* case of the object having been copied between Commit updating i */ |
| 837 | /* and testing limit) */ | 841 | /* and testing limit) */ |
| 838 | AVER(AddrAdd(p, size) == buffer->apStruct.init); | 842 | AVER(AddrAdd(p, size) == buffer->ap_s.init); |
| 839 | 843 | ||
| 840 | pool = BufferPool(buffer); | 844 | pool = BufferPool(buffer); |
| 841 | 845 | ||
| @@ -847,13 +851,13 @@ Bool BufferTrip(Buffer buffer, Addr p, Size size) | |||
| 847 | /* Otherwise (see .commit.after) the object is valid (will've been */ | 851 | /* Otherwise (see .commit.after) the object is valid (will've been */ |
| 848 | /* scanned) so commit can simply succeed. */ | 852 | /* scanned) so commit can simply succeed. */ |
| 849 | if ((buffer->mode & BufferModeFLIPPED) | 853 | if ((buffer->mode & BufferModeFLIPPED) |
| 850 | && buffer->apStruct.init != buffer->initAtFlip) { | 854 | && buffer->ap_s.init != buffer->initAtFlip) { |
| 851 | /* Reset just enough state for Reserve/Fill to work. */ | 855 | /* Reset just enough state for Reserve/Fill to work. */ |
| 852 | /* The buffer is left trapped and we leave the untrapping */ | 856 | /* The buffer is left trapped and we leave the untrapping */ |
| 853 | /* for the next reserve (which goes out of line to Fill */ | 857 | /* for the next reserve (which goes out of line to Fill */ |
| 854 | /* (.fill.unflip) because the buffer is still trapped) */ | 858 | /* (.fill.unflip) because the buffer is still trapped) */ |
| 855 | buffer->apStruct.init = p; | 859 | buffer->ap_s.init = p; |
| 856 | buffer->apStruct.alloc = p; | 860 | buffer->ap_s.alloc = p; |
| 857 | return FALSE; | 861 | return FALSE; |
| 858 | } | 862 | } |
| 859 | 863 | ||
| @@ -901,9 +905,9 @@ void BufferFlip(Buffer buffer) | |||
| 901 | && (buffer->mode & BufferModeFLIPPED) == 0 | 905 | && (buffer->mode & BufferModeFLIPPED) == 0 |
| 902 | && !BufferIsReset(buffer)) { | 906 | && !BufferIsReset(buffer)) { |
| 903 | AVER(buffer->initAtFlip == (Addr)0); | 907 | AVER(buffer->initAtFlip == (Addr)0); |
| 904 | buffer->initAtFlip = buffer->apStruct.init; | 908 | buffer->initAtFlip = buffer->ap_s.init; |
| 905 | /* Memory Barrier here? @@@@ */ | 909 | /* Memory Barrier here? @@@@ */ |
| 906 | buffer->apStruct.limit = (Addr)0; | 910 | buffer->ap_s.limit = (Addr)0; |
| 907 | buffer->mode |= BufferModeFLIPPED; | 911 | buffer->mode |= BufferModeFLIPPED; |
| 908 | } | 912 | } |
| 909 | } | 913 | } |
| @@ -922,7 +926,7 @@ Addr BufferScanLimit(Buffer buffer) | |||
| 922 | if (buffer->mode & BufferModeFLIPPED) { | 926 | if (buffer->mode & BufferModeFLIPPED) { |
| 923 | return buffer->initAtFlip; | 927 | return buffer->initAtFlip; |
| 924 | } else { | 928 | } else { |
| 925 | return buffer->apStruct.init; | 929 | return buffer->ap_s.init; |
| 926 | } | 930 | } |
| 927 | } | 931 | } |
| 928 | 932 | ||
| @@ -984,9 +988,9 @@ Bool BufferIsTrapped(Buffer buffer) | |||
| 984 | 988 | ||
| 985 | Bool BufferIsTrappedByMutator(Buffer buffer) | 989 | Bool BufferIsTrappedByMutator(Buffer buffer) |
| 986 | { | 990 | { |
| 987 | AVER(!buffer->apStruct.lwPopPending || buffer->apStruct.enabled); | 991 | AVER(!buffer->ap_s._lwpoppending || buffer->ap_s._enabled); |
| 988 | /* Can't check buffer, see .check.use-trapped */ | 992 | /* Can't check buffer, see .check.use-trapped */ |
| 989 | return buffer->apStruct.lwPopPending; | 993 | return buffer->ap_s._lwpoppending; |
| 990 | } | 994 | } |
| 991 | 995 | ||
| 992 | 996 | ||
diff --git a/mps/code/exposet0.c b/mps/code/exposet0.c index c7000214d97..f5a0b1e9e49 100644 --- a/mps/code/exposet0.c +++ b/mps/code/exposet0.c | |||
| @@ -151,8 +151,8 @@ static void *test(void *arg, size_t s) | |||
| 151 | die(mps_pool_create(&pool_g, arena, mps_class_amc(), format, chain), | 151 | die(mps_pool_create(&pool_g, arena, mps_class_amc(), format, chain), |
| 152 | "pool_create(amc)"); | 152 | "pool_create(amc)"); |
| 153 | 153 | ||
| 154 | die(mps_ap_create(&ap, pool_g, MPS_RANK_EXACT), "BufferCreate"); | 154 | die(mps_ap_create(&ap, pool_g, mps_rank_exact()), "BufferCreate"); |
| 155 | die(mps_ap_create(&busy_ap, pool_g, MPS_RANK_EXACT), "BufferCreate 2"); | 155 | die(mps_ap_create(&busy_ap, pool_g, mps_rank_exact()), "BufferCreate 2"); |
| 156 | 156 | ||
| 157 | for(i = 0; i < exactRootsCOUNT; ++i) { | 157 | for(i = 0; i < exactRootsCOUNT; ++i) { |
| 158 | exactRoots[i] = objNULL; | 158 | exactRoots[i] = objNULL; |
| @@ -162,12 +162,12 @@ static void *test(void *arg, size_t s) | |||
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | die(mps_root_create_table_masked(&exactRoot, arena, | 164 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 165 | MPS_RANK_EXACT, (mps_rm_t)0, | 165 | mps_rank_exact(), (mps_rm_t)0, |
| 166 | &exactRoots[0], exactRootsCOUNT, | 166 | &exactRoots[0], exactRootsCOUNT, |
| 167 | (mps_word_t)1), | 167 | (mps_word_t)1), |
| 168 | "root_create_table(exact)"); | 168 | "root_create_table(exact)"); |
| 169 | die(mps_root_create_table(&ambigRoot, arena, | 169 | die(mps_root_create_table(&ambigRoot, arena, |
| 170 | MPS_RANK_AMBIG, (mps_rm_t)0, | 170 | mps_rank_ambig(), (mps_rm_t)0, |
| 171 | &ambigRoots[0], ambigRootsCOUNT), | 171 | &ambigRoots[0], ambigRootsCOUNT), |
| 172 | "root_create_table(ambig)"); | 172 | "root_create_table(ambig)"); |
| 173 | 173 | ||
diff --git a/mps/code/expt825.c b/mps/code/expt825.c index 8e71df402c8..588716f49de 100644 --- a/mps/code/expt825.c +++ b/mps/code/expt825.c | |||
| @@ -152,10 +152,10 @@ static void *test(void *arg, size_t s) | |||
| 152 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); | 152 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); |
| 153 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), | 153 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), |
| 154 | "pool_create amc\n"); | 154 | "pool_create amc\n"); |
| 155 | die(mps_root_create_table(&mps_root, arena, MPS_RANK_EXACT, (mps_rm_t)0, | 155 | die(mps_root_create_table(&mps_root, arena, mps_rank_exact(), (mps_rm_t)0, |
| 156 | root, (size_t)rootCOUNT), | 156 | root, (size_t)rootCOUNT), |
| 157 | "root_create\n"); | 157 | "root_create\n"); |
| 158 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create\n"); | 158 | die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create\n"); |
| 159 | 159 | ||
| 160 | mps_message_type_enable(arena, mps_message_type_finalization()); | 160 | mps_message_type_enable(arena, mps_message_type_finalization()); |
| 161 | 161 | ||
diff --git a/mps/code/finalcv.c b/mps/code/finalcv.c index 355c841e1ae..79a38dbbfb3 100644 --- a/mps/code/finalcv.c +++ b/mps/code/finalcv.c | |||
| @@ -117,13 +117,13 @@ static void *test(void *arg, size_t s) | |||
| 117 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); | 117 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); |
| 118 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), | 118 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), |
| 119 | "pool_create amc\n"); | 119 | "pool_create amc\n"); |
| 120 | die(mps_root_create_table(&mps_root[0], arena, MPS_RANK_EXACT, (mps_rm_t)0, | 120 | die(mps_root_create_table(&mps_root[0], arena, mps_rank_exact(), (mps_rm_t)0, |
| 121 | root, (size_t)rootCOUNT), | 121 | root, (size_t)rootCOUNT), |
| 122 | "root_create\n"); | 122 | "root_create\n"); |
| 123 | die(mps_root_create_table(&mps_root[1], arena, MPS_RANK_EXACT, (mps_rm_t)0, | 123 | die(mps_root_create_table(&mps_root[1], arena, mps_rank_exact(), (mps_rm_t)0, |
| 124 | &p, (size_t)1), | 124 | &p, (size_t)1), |
| 125 | "root_create\n"); | 125 | "root_create\n"); |
| 126 | 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"); |
| 127 | 127 | ||
| 128 | /* Make registered-for-finalization objects. */ | 128 | /* Make registered-for-finalization objects. */ |
| 129 | /* <design/poolmrg/#test.promise.ut.alloc> */ | 129 | /* <design/poolmrg/#test.promise.ut.alloc> */ |
diff --git a/mps/code/finaltest.c b/mps/code/finaltest.c index 79496801acb..9351688a9ce 100644 --- a/mps/code/finaltest.c +++ b/mps/code/finaltest.c | |||
| @@ -142,10 +142,10 @@ static void *test(void *arg, size_t s) | |||
| 142 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); | 142 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); |
| 143 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), | 143 | die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain), |
| 144 | "pool_create amc\n"); | 144 | "pool_create amc\n"); |
| 145 | die(mps_root_create_table(&mps_root, arena, MPS_RANK_EXACT, (mps_rm_t)0, | 145 | die(mps_root_create_table(&mps_root, arena, mps_rank_exact(), (mps_rm_t)0, |
| 146 | root, (size_t)rootCOUNT), | 146 | root, (size_t)rootCOUNT), |
| 147 | "root_create\n"); | 147 | "root_create\n"); |
| 148 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create\n"); | 148 | die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create\n"); |
| 149 | 149 | ||
| 150 | mps_message_type_enable(arena, mps_message_type_finalization()); | 150 | mps_message_type_enable(arena, mps_message_type_finalization()); |
| 151 | 151 | ||
diff --git a/mps/code/ld.c b/mps/code/ld.c index bca8b63c05a..766bfe5d823 100644 --- a/mps/code/ld.c +++ b/mps/code/ld.c | |||
| @@ -57,7 +57,7 @@ SRCID(ld, "$Id$"); | |||
| 57 | * because if the epoch advances after it is read the dependency | 57 | * because if the epoch advances after it is read the dependency |
| 58 | * will simply include movement for more time than necessary. | 58 | * will simply include movement for more time than necessary. |
| 59 | */ | 59 | */ |
| 60 | void LDReset(LD ld, Arena arena) | 60 | void LDReset(mps_ld_t ld, Arena arena) |
| 61 | { | 61 | { |
| 62 | Bool b; | 62 | Bool b; |
| 63 | Seg seg; | 63 | Seg seg; |
| @@ -68,8 +68,8 @@ void LDReset(LD ld, Arena arena) | |||
| 68 | b = SegOfAddr(&seg, arena, (Addr)ld); | 68 | b = SegOfAddr(&seg, arena, (Addr)ld); |
| 69 | if (b) | 69 | if (b) |
| 70 | ShieldExpose(arena, seg); /* .ld.access */ | 70 | ShieldExpose(arena, seg); /* .ld.access */ |
| 71 | ld->epoch = arena->epoch; | 71 | ld->_epoch = arena->epoch; |
| 72 | ld->rs = RefSetEMPTY; | 72 | ld->_rs = RefSetEMPTY; |
| 73 | if (b) | 73 | if (b) |
| 74 | ShieldCover(arena, seg); | 74 | ShieldCover(arena, seg); |
| 75 | } | 75 | } |
| @@ -93,12 +93,12 @@ void LDReset(LD ld, Arena arena) | |||
| 93 | * were used first only the new location of the reference would end up | 93 | * were used first only the new location of the reference would end up |
| 94 | * in the set. | 94 | * in the set. |
| 95 | */ | 95 | */ |
| 96 | void LDAdd(LD ld, Arena arena, Addr addr) | 96 | void LDAdd(mps_ld_t ld, Arena arena, Addr addr) |
| 97 | { | 97 | { |
| 98 | AVER(ld->epoch <= arena->epoch); | 98 | AVER(ld->_epoch <= arena->epoch); |
| 99 | /* AVERT(Arena, arena) -- see .add.lock-free */ | 99 | /* AVERT(Arena, arena) -- see .add.lock-free */ |
| 100 | 100 | ||
| 101 | ld->rs = RefSetAdd(arena, ld->rs, addr); | 101 | ld->_rs = RefSetAdd(arena, ld->_rs, addr); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | 104 | ||
| @@ -115,36 +115,36 @@ void LDAdd(LD ld, Arena arena, Addr addr) | |||
| 115 | * with everything which has moved since it was initialized. | 115 | * with everything which has moved since it was initialized. |
| 116 | * | 116 | * |
| 117 | * .stale.recent.conservative: The refset from the history table is | 117 | * .stale.recent.conservative: The refset from the history table is |
| 118 | * loaded before we check whether ld->epoch is "recent" with respect to | 118 | * loaded before we check whether ld->_epoch is "recent" with respect to |
| 119 | * the current epoch. This means that we may (conservatively) decide | 119 | * the current epoch. This means that we may (conservatively) decide |
| 120 | * to use the prehistory instead. | 120 | * to use the prehistory instead. |
| 121 | * | 121 | * |
| 122 | * .stale.old: Otherwise, if the dependency is older than the length | 122 | * .stale.old: Otherwise, if the dependency is older than the length |
| 123 | * of the history, check it against all movement that has ever occured. | 123 | * of the history, check it against all movement that has ever occured. |
| 124 | */ | 124 | */ |
| 125 | Bool LDIsStale(LD ld, Arena arena, Addr addr) | 125 | Bool LDIsStale(mps_ld_t ld, Arena arena, Addr addr) |
| 126 | { | 126 | { |
| 127 | RefSet rs; | 127 | RefSet rs; |
| 128 | 128 | ||
| 129 | UNUSED(addr); | 129 | UNUSED(addr); |
| 130 | 130 | ||
| 131 | AVER(ld->epoch <= arena->epoch); | 131 | AVER(ld->_epoch <= arena->epoch); |
| 132 | /* AVERT(Arena, arena) -- .stale.thread-safe */ | 132 | /* AVERT(Arena, arena) -- .stale.thread-safe */ |
| 133 | 133 | ||
| 134 | if (arena->epoch == ld->epoch) /* .stale.current */ | 134 | if (arena->epoch == ld->_epoch) /* .stale.current */ |
| 135 | return FALSE; | 135 | return FALSE; |
| 136 | 136 | ||
| 137 | /* Load the history refset, _then_ check to see if it's recent. | 137 | /* Load the history refset, _then_ check to see if it's recent. |
| 138 | * This may in fact load an okay refset, which we decide to throw | 138 | * This may in fact load an okay refset, which we decide to throw |
| 139 | * away and use the pre-history instead. */ | 139 | * away and use the pre-history instead. */ |
| 140 | rs = arena->history[ld->epoch % LDHistoryLENGTH]; | 140 | rs = arena->history[ld->_epoch % LDHistoryLENGTH]; |
| 141 | /* .stale.recent */ | 141 | /* .stale.recent */ |
| 142 | /* .stale.recent.conservative */ | 142 | /* .stale.recent.conservative */ |
| 143 | if (arena->epoch - ld->epoch > LDHistoryLENGTH) { | 143 | if (arena->epoch - ld->_epoch > LDHistoryLENGTH) { |
| 144 | rs = arena->prehistory; /* .stale.old */ | 144 | rs = arena->prehistory; /* .stale.old */ |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | return RefSetInter(ld->rs, rs) != RefSetEMPTY; | 147 | return RefSetInter(ld->_rs, rs) != RefSetEMPTY; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | 150 | ||
| @@ -191,22 +191,22 @@ void LDAge(Arena arena, RefSet rs) | |||
| 191 | * (rest of the) MPS. It is unnecessary to claim locks before calling | 191 | * (rest of the) MPS. It is unnecessary to claim locks before calling |
| 192 | * this function. | 192 | * this function. |
| 193 | */ | 193 | */ |
| 194 | void LDMerge(LD ld, Arena arena, LD from) | 194 | void LDMerge(mps_ld_t ld, Arena arena, mps_ld_t from) |
| 195 | { | 195 | { |
| 196 | /* AVERT(Arena, arena); -- .merge.lock-free */ | 196 | /* AVERT(Arena, arena); -- .merge.lock-free */ |
| 197 | AVER(ld != NULL); | 197 | AVER(ld != NULL); |
| 198 | AVER(ld->epoch <= arena->epoch); | 198 | AVER(ld->_epoch <= arena->epoch); |
| 199 | AVER(from != NULL); | 199 | AVER(from != NULL); |
| 200 | AVER(from->epoch <= arena->epoch); | 200 | AVER(from->_epoch <= arena->epoch); |
| 201 | 201 | ||
| 202 | /* If a reference has been added since epoch e1 then I've */ | 202 | /* If a reference has been added since epoch e1 then I've */ |
| 203 | /* certainly added since epoch e0 where e0 < e1. Therefore */ | 203 | /* certainly added since epoch e0 where e0 < e1. Therefore */ |
| 204 | /* the epoch of the merged ld is the minimum. */ | 204 | /* the epoch of the merged ld is the minimum. */ |
| 205 | if (from->epoch < ld->epoch) | 205 | if (from->_epoch < ld->_epoch) |
| 206 | ld->epoch = from->epoch; | 206 | ld->_epoch = from->_epoch; |
| 207 | 207 | ||
| 208 | /* The set of references added is the union of the two. */ | 208 | /* The set of references added is the union of the two. */ |
| 209 | ld->rs = RefSetUnion(ld->rs, from->rs); | 209 | ld->_rs = RefSetUnion(ld->_rs, from->_rs); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | 212 | ||
diff --git a/mps/code/locv.c b/mps/code/locv.c index 010983fd878..76260ed526b 100644 --- a/mps/code/locv.c +++ b/mps/code/locv.c | |||
| @@ -52,7 +52,7 @@ int main(void) | |||
| 52 | 52 | ||
| 53 | die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), | 53 | die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), |
| 54 | "mps_arena_create"); | 54 | "mps_arena_create"); |
| 55 | die(mps_root_create_table(&root, arena, MPS_RANK_EXACT, | 55 | die(mps_root_create_table(&root, arena, mps_rank_exact(), |
| 56 | (mps_rm_t)0, | 56 | (mps_rm_t)0, |
| 57 | roots, (sizeof(roots)/sizeof(*roots))), | 57 | roots, (sizeof(roots)/sizeof(*roots))), |
| 58 | "RootCreate"); | 58 | "RootCreate"); |
| @@ -61,7 +61,7 @@ int main(void) | |||
| 61 | 61 | ||
| 62 | die(mps_pool_create(&pool, arena, mps_class_lo(), format), "LOCreate"); | 62 | die(mps_pool_create(&pool, arena, mps_class_lo(), format), "LOCreate"); |
| 63 | 63 | ||
| 64 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "APCreate"); | 64 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "APCreate"); |
| 65 | 65 | ||
| 66 | die(mps_reserve(&p, ap, sizeof(void *)), "mps_reserve min"); | 66 | die(mps_reserve(&p, ap, sizeof(void *)), "mps_reserve min"); |
| 67 | *(mps_word_t *)p = sizeof(void *); | 67 | *(mps_word_t *)p = sizeof(void *); |
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index f8f2e9e7466..bdf4ba79d74 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -366,6 +366,14 @@ extern Bool ScanStateCheck(ScanState ss); | |||
| 366 | extern void ScanStateSetSummary(ScanState ss, RefSet summary); | 366 | extern void ScanStateSetSummary(ScanState ss, RefSet summary); |
| 367 | extern RefSet ScanStateSummary(ScanState ss); | 367 | extern RefSet ScanStateSummary(ScanState ss); |
| 368 | 368 | ||
| 369 | /* See impl.h.mpmst.ss */ | ||
| 370 | #define ScanStateZoneShift(ss) ((Shift)(ss)->ss_s._zs) | ||
| 371 | #define ScanStateWhite(ss) ((ZoneSet)(ss)->ss_s._w) | ||
| 372 | #define ScanStateUnfixedSummary(ss) ((RefSet)(ss)->ss_s._ufs) | ||
| 373 | #define ScanStateSetZoneShift(ss, shift) ((void)((ss)->ss_s._zs = (shift))) | ||
| 374 | #define ScanStateSetWhite(ss, zs) ((void)((ss)->ss_s._w = (zs))) | ||
| 375 | #define ScanStateSetUnfixedSummary(ss, rs) ((void)((ss)->ss_s._ufs = (rs))) | ||
| 376 | |||
| 369 | extern Bool TraceIdCheck(TraceId id); | 377 | extern Bool TraceIdCheck(TraceId id); |
| 370 | extern Bool TraceSetCheck(TraceSet ts); | 378 | extern Bool TraceSetCheck(TraceSet ts); |
| 371 | extern Bool TraceCheck(Trace trace); | 379 | extern Bool TraceCheck(Trace trace); |
| @@ -405,11 +413,11 @@ extern double TraceWorkFactor; | |||
| 405 | #define TRACE_SCAN_BEGIN(ss) \ | 413 | #define TRACE_SCAN_BEGIN(ss) \ |
| 406 | BEGIN \ | 414 | BEGIN \ |
| 407 | /* Check range on zoneShift before casting to Shift. */ \ | 415 | /* Check range on zoneShift before casting to Shift. */ \ |
| 408 | AVER((ss)->zoneShift < MPS_WORD_WIDTH); \ | 416 | AVER(ScanStateZoneShift(ss) < MPS_WORD_WIDTH); \ |
| 409 | { \ | 417 | { \ |
| 410 | Shift SCANzoneShift = (Shift)(ss)->zoneShift; \ | 418 | Shift SCANzoneShift = ScanStateZoneShift(ss); \ |
| 411 | ZoneSet SCANwhite = (ss)->white; \ | 419 | ZoneSet SCANwhite = ScanStateWhite(ss); \ |
| 412 | RefSet SCANsummary = (ss)->unfixedSummary; \ | 420 | RefSet SCANsummary = ScanStateUnfixedSummary(ss); \ |
| 413 | Word SCANt; \ | 421 | Word SCANt; \ |
| 414 | { | 422 | { |
| 415 | 423 | ||
| @@ -422,7 +430,7 @@ extern double TraceWorkFactor; | |||
| 422 | 430 | ||
| 423 | /* Equivalent to <code/mps.h> MPS_FIX2 */ | 431 | /* Equivalent to <code/mps.h> MPS_FIX2 */ |
| 424 | 432 | ||
| 425 | #define TRACE_FIX2(ss, refIO) mps_fix2((mps_ss_t)(ss), (mps_addr_t *)(refIO)) | 433 | #define TRACE_FIX2(ss, refIO) _mps_fix2((mps_ss_t)(ss), (mps_addr_t *)(refIO)) |
| 426 | 434 | ||
| 427 | /* Equivalent to <code/mps.h> MPS_FIX */ | 435 | /* Equivalent to <code/mps.h> MPS_FIX */ |
| 428 | 436 | ||
| @@ -433,7 +441,7 @@ extern double TraceWorkFactor; | |||
| 433 | 441 | ||
| 434 | #define TRACE_SCAN_END(ss) \ | 442 | #define TRACE_SCAN_END(ss) \ |
| 435 | } \ | 443 | } \ |
| 436 | (ss)->unfixedSummary = SCANsummary; \ | 444 | ScanStateSetUnfixedSummary(ss, SCANsummary); \ |
| 437 | } \ | 445 | } \ |
| 438 | END | 446 | END |
| 439 | 447 | ||
| @@ -693,9 +701,11 @@ extern Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream); | |||
| 693 | extern Res BufferReserve(Addr *pReturn, Buffer buffer, Size size, | 701 | extern Res BufferReserve(Addr *pReturn, Buffer buffer, Size size, |
| 694 | Bool withReservoirPermit); | 702 | Bool withReservoirPermit); |
| 695 | /* macro equivalent for BufferReserve, keep in sync with <code/buffer.c> */ | 703 | /* macro equivalent for BufferReserve, keep in sync with <code/buffer.c> */ |
| 704 | /* TODO: Perhaps this isn't really necessary now that we build the MPS with | ||
| 705 | more global optimisation and inlining. RB 2012-09-07 */ | ||
| 696 | #define BUFFER_RESERVE(pReturn, buffer, size, withReservoirPermit) \ | 706 | #define BUFFER_RESERVE(pReturn, buffer, size, withReservoirPermit) \ |
| 697 | (AddrAdd(BufferAlloc(buffer), size) > BufferAlloc(buffer) && \ | 707 | (AddrAdd(BufferAlloc(buffer), size) > BufferAlloc(buffer) && \ |
| 698 | AddrAdd(BufferAlloc(buffer), size) <= BufferAP(buffer)->limit ? \ | 708 | AddrAdd(BufferAlloc(buffer), size) <= (Addr)BufferAP(buffer)->limit ? \ |
| 699 | (*(pReturn) = BufferAlloc(buffer), \ | 709 | (*(pReturn) = BufferAlloc(buffer), \ |
| 700 | BufferAP(buffer)->alloc = AddrAdd(BufferAlloc(buffer), size), \ | 710 | BufferAP(buffer)->alloc = AddrAdd(BufferAlloc(buffer), size), \ |
| 701 | ResOK) : \ | 711 | ResOK) : \ |
| @@ -706,6 +716,8 @@ extern Res BufferFill(Addr *pReturn, Buffer buffer, Size size, | |||
| 706 | 716 | ||
| 707 | extern Bool BufferCommit(Buffer buffer, Addr p, Size size); | 717 | extern Bool BufferCommit(Buffer buffer, Addr p, Size size); |
| 708 | /* macro equivalent for BufferCommit, keep in sync with <code/buffer.c> */ | 718 | /* macro equivalent for BufferCommit, keep in sync with <code/buffer.c> */ |
| 719 | /* TODO: Perhaps this isn't really necessary now that we build the MPS with | ||
| 720 | more global optimisation and inlining. RB 2012-09-07 */ | ||
| 709 | #define BUFFER_COMMIT(buffer, p, size) \ | 721 | #define BUFFER_COMMIT(buffer, p, size) \ |
| 710 | (BufferAP(buffer)->init = BufferAlloc(buffer), \ | 722 | (BufferAP(buffer)->init = BufferAlloc(buffer), \ |
| 711 | BufferAP(buffer)->limit != 0 || BufferTrip(buffer, p, size)) | 723 | BufferAP(buffer)->limit != 0 || BufferTrip(buffer, p, size)) |
| @@ -721,10 +733,10 @@ extern void BufferAttach(Buffer buffer, | |||
| 721 | extern void BufferDetach(Buffer buffer, Pool pool); | 733 | extern void BufferDetach(Buffer buffer, Pool pool); |
| 722 | extern void BufferFlip(Buffer buffer); | 734 | extern void BufferFlip(Buffer buffer); |
| 723 | 735 | ||
| 724 | extern AP (BufferAP)(Buffer buffer); | 736 | extern mps_ap_t (BufferAP)(Buffer buffer); |
| 725 | #define BufferAP(buffer) (&(buffer)->apStruct) | 737 | #define BufferAP(buffer) (&(buffer)->ap_s) |
| 726 | extern Buffer BufferOfAP(AP ap); | 738 | extern Buffer BufferOfAP(mps_ap_t ap); |
| 727 | #define BufferOfAP(ap) PARENT(BufferStruct, apStruct, ap) | 739 | #define BufferOfAP(ap) PARENT(BufferStruct, ap_s, ap) |
| 728 | 740 | ||
| 729 | #define BufferArena(buffer) ((buffer)->arena) | 741 | #define BufferArena(buffer) ((buffer)->arena) |
| 730 | #define BufferPool(buffer) ((buffer)->pool) | 742 | #define BufferPool(buffer) ((buffer)->pool) |
| @@ -736,8 +748,8 @@ extern void BufferSetRankSet(Buffer buffer, RankSet rankset); | |||
| 736 | 748 | ||
| 737 | #define BufferBase(buffer) ((buffer)->base) | 749 | #define BufferBase(buffer) ((buffer)->base) |
| 738 | #define BufferGetInit(buffer) /* see .trans.bufferinit */ \ | 750 | #define BufferGetInit(buffer) /* see .trans.bufferinit */ \ |
| 739 | (BufferAP(buffer)->init) | 751 | ((Addr)(BufferAP(buffer)->init)) |
| 740 | #define BufferAlloc(buffer) (BufferAP(buffer)->alloc) | 752 | #define BufferAlloc(buffer) ((Addr)(BufferAP(buffer)->alloc)) |
| 741 | #define BufferLimit(buffer) ((buffer)->poolLimit) | 753 | #define BufferLimit(buffer) ((buffer)->poolLimit) |
| 742 | extern Addr BufferScanLimit(Buffer buffer); | 754 | extern Addr BufferScanLimit(Buffer buffer); |
| 743 | 755 | ||
| @@ -890,11 +902,11 @@ extern Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc); | |||
| 890 | 902 | ||
| 891 | /* Location Dependency -- see <code/ld.c> */ | 903 | /* Location Dependency -- see <code/ld.c> */ |
| 892 | 904 | ||
| 893 | extern void LDReset(LD ld, Arena arena); | 905 | extern void LDReset(mps_ld_t ld, Arena arena); |
| 894 | extern void LDAdd(LD ld, Arena arena, Addr addr); | 906 | extern void LDAdd(mps_ld_t ld, Arena arena, Addr addr); |
| 895 | extern Bool LDIsStale(LD ld, Arena arena, Addr addr); | 907 | extern Bool LDIsStale(mps_ld_t ld, Arena arena, Addr addr); |
| 896 | extern void LDAge(Arena arena, RefSet moved); | 908 | extern void LDAge(Arena arena, RefSet moved); |
| 897 | extern void LDMerge(LD ld, Arena arena, LD from); | 909 | extern void LDMerge(mps_ld_t ld, Arena arena, mps_ld_t from); |
| 898 | 910 | ||
| 899 | 911 | ||
| 900 | /* Root Interface -- see <code/root.c> */ | 912 | /* Root Interface -- see <code/root.c> */ |
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 8807d086b66..9f1edbe6141 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -343,33 +343,15 @@ typedef struct BufferClassStruct { | |||
| 343 | } BufferClassStruct; | 343 | } BufferClassStruct; |
| 344 | 344 | ||
| 345 | 345 | ||
| 346 | |||
| 347 | |||
| 348 | /* APStruct -- allocation point structure | ||
| 349 | * | ||
| 350 | * AP are part of the design of buffers see <design/buffer/>. | ||
| 351 | * | ||
| 352 | * The allocation point is exported to the client code so that it can | ||
| 353 | * do in-line buffered allocation. | ||
| 354 | * | ||
| 355 | * .ap: This structure must match <code/mps.h#ap>. See also | ||
| 356 | * <code/mpsi.c#check.ap>. */ | ||
| 357 | |||
| 358 | typedef struct APStruct { | ||
| 359 | Addr init; /* limit of initialized area */ | ||
| 360 | Addr alloc; /* limit of allocated area */ | ||
| 361 | Addr limit; /* limit of allocation buffer */ | ||
| 362 | Addr frameptr; /* lightweight frame pointer */ | ||
| 363 | Bool enabled; /* lightweight frame status */ | ||
| 364 | Bool lwPopPending; /* lightweight pop pending? */ | ||
| 365 | } APStruct; | ||
| 366 | |||
| 367 | |||
| 368 | /* BufferStruct -- allocation buffer structure | 346 | /* BufferStruct -- allocation buffer structure |
| 369 | * | 347 | * |
| 370 | * See <code/buffer.c>, <design/buffer/>. | 348 | * See <code/buffer.c>, <design/buffer/>. |
| 371 | * | 349 | * |
| 372 | * The buffer contains an AP which may be exported to the client. */ | 350 | * The buffer contains an AP which may be exported to the client. |
| 351 | * AP are part of the design of buffers see <design/buffer/>. | ||
| 352 | * The allocation point is exported to the client code so that it can | ||
| 353 | * do in-line buffered allocation. | ||
| 354 | */ | ||
| 373 | 355 | ||
| 374 | #define BufferSig ((Sig)0x519B0FFE) /* SIGnature BUFFEr */ | 356 | #define BufferSig ((Sig)0x519B0FFE) /* SIGnature BUFFEr */ |
| 375 | 357 | ||
| @@ -386,7 +368,7 @@ typedef struct BufferStruct { | |||
| 386 | double emptySize; /* bytes emptied from this buffer */ | 368 | double emptySize; /* bytes emptied from this buffer */ |
| 387 | Addr base; /* base address of allocation buffer */ | 369 | Addr base; /* base address of allocation buffer */ |
| 388 | Addr initAtFlip; /* limit of initialized data at flip */ | 370 | Addr initAtFlip; /* limit of initialized data at flip */ |
| 389 | APStruct apStruct; /* the allocation point */ | 371 | mps_ap_s ap_s; /* the allocation point */ |
| 390 | Addr poolLimit; /* the pool's idea of the limit */ | 372 | Addr poolLimit; /* the pool's idea of the limit */ |
| 391 | Align alignment; /* allocation alignment */ | 373 | Align alignment; /* allocation alignment */ |
| 392 | unsigned rampCount; /* see <code/buffer.c#ramp.hack> */ | 374 | unsigned rampCount; /* see <code/buffer.c#ramp.hack> */ |
| @@ -435,40 +417,32 @@ typedef struct FormatStruct { | |||
| 435 | } FormatStruct; | 417 | } FormatStruct; |
| 436 | 418 | ||
| 437 | 419 | ||
| 438 | /* LDStruct -- location dependency structure | ||
| 439 | * | ||
| 440 | * See design.mps.ld, and <code/ld.c>. | ||
| 441 | * | ||
| 442 | * A version of this structure is exported to the client. .ld.struct: | ||
| 443 | * This must be kept in sync with <code/mps.h#ld>. See also | ||
| 444 | * <code/mpsi.c#check.ld>. */ | ||
| 445 | |||
| 446 | typedef struct LDStruct { | ||
| 447 | Epoch epoch; /* epoch when ld was last reset / init'ed */ | ||
| 448 | RefSet rs; /* RefSet of Add'ed references */ | ||
| 449 | } LDStruct; | ||
| 450 | |||
| 451 | |||
| 452 | /* ScanState | 420 | /* ScanState |
| 453 | * | 421 | * |
| 454 | * .ss: See <code/trace.c>. | 422 | * .ss: See <code/trace.c>. |
| 455 | * | 423 | * |
| 456 | * .ss: The first three fields of the trace structure must match the | 424 | * .ss: The mps_ss field of the scan state structure is exported |
| 457 | * external scan state structure (mps_ss_s) thus: | 425 | * through the MPS interface to optimise the critical path scan loop. |
| 458 | * ss->zoneShift mps_ss->w0 | 426 | * |
| 459 | * ss->white mps_ss->w1 | 427 | * .ss.zone: For binary compatibility, the zone shift is exported as |
| 460 | * ss->unfixedSummary mps_ss->w2 | 428 | * a word rather than a shift, so that the external mps_ss_s is a uniform |
| 461 | * See <code/mps.h#ss> and <code/mpsi.c#check.ss>. This is why the Sig | 429 | * three-word structure. See <code/mps.h#ss> and <design/interface-c>. |
| 462 | * field is in the middle of this structure. .ss.zone: The zoneShift | 430 | * |
| 463 | * field is therefore declared as Word rather than Shift. */ | 431 | * zs Shift zoneShift copy of arena->zoneShift. See .ss.zone |
| 432 | * w ZoneSet white white set, for inline fix test | ||
| 433 | * ufs RefSet unfixedSummary accumulated summary of scanned references | ||
| 434 | * | ||
| 435 | * NOTE: The mps_ss structure used to be obfuscated to preserve Harlequin's | ||
| 436 | * trade secrets in the MPS technology. These days they just seek to | ||
| 437 | * emphasize the abstraction, and could maybe be given better names and | ||
| 438 | * types. RB 2012-09-07 | ||
| 439 | */ | ||
| 464 | 440 | ||
| 465 | #define ScanStateSig ((Sig)0x5195CA45) /* SIGnature SCAN State */ | 441 | #define ScanStateSig ((Sig)0x5195CA45) /* SIGnature SCAN State */ |
| 466 | 442 | ||
| 467 | typedef struct ScanStateStruct { | 443 | typedef struct ScanStateStruct { |
| 468 | Word zoneShift; /* copy of arena->zoneShift. See .ss.zone */ | ||
| 469 | ZoneSet white; /* white set, for inline fix test */ | ||
| 470 | RefSet unfixedSummary; /* accumulated summary of scanned references */ | ||
| 471 | Sig sig; /* <design/sig/> */ | 444 | Sig sig; /* <design/sig/> */ |
| 445 | struct mps_ss_s ss_s; /* .ss <http://bash.org/?400459> */ | ||
| 472 | Arena arena; /* owning arena */ | 446 | Arena arena; /* owning arena */ |
| 473 | PoolFixMethod fix; /* third stage fix function */ | 447 | PoolFixMethod fix; /* third stage fix function */ |
| 474 | void *fixClosure; /* closure data for fix */ | 448 | void *fixClosure; /* closure data for fix */ |
| @@ -630,7 +604,7 @@ typedef struct GlobalsStruct { | |||
| 630 | 604 | ||
| 631 | #define ArenaSig ((Sig)0x519A6E4A) /* SIGnature ARENA */ | 605 | #define ArenaSig ((Sig)0x519A6E4A) /* SIGnature ARENA */ |
| 632 | 606 | ||
| 633 | typedef struct ArenaStruct { | 607 | typedef struct mps_arena_s { |
| 634 | GlobalsStruct globals; /* must be first, see <design/arena/#globals> */ | 608 | GlobalsStruct globals; /* must be first, see <design/arena/#globals> */ |
| 635 | Serial serial; | 609 | Serial serial; |
| 636 | 610 | ||
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 66d5b533546..a15098c53ee 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -67,9 +67,7 @@ typedef BufferClass SegBufClass; /* <design/buffer/> */ | |||
| 67 | typedef BufferClass RankBufClass; /* <design/buffer/> */ | 67 | typedef BufferClass RankBufClass; /* <design/buffer/> */ |
| 68 | typedef unsigned BufferMode; /* <design/buffer/> */ | 68 | typedef unsigned BufferMode; /* <design/buffer/> */ |
| 69 | typedef unsigned FrameState; /* <design/alloc-frame/> */ | 69 | typedef unsigned FrameState; /* <design/alloc-frame/> */ |
| 70 | typedef struct APStruct *AP; /* <design/buffer/> */ | ||
| 71 | typedef struct FormatStruct *Format; /* design.mps.format */ | 70 | typedef struct FormatStruct *Format; /* design.mps.format */ |
| 72 | typedef struct LDStruct *LD; /* design.mps.ld */ | ||
| 73 | typedef struct LockStruct *Lock; /* <code/lock.c>* */ | 71 | typedef struct LockStruct *Lock; /* <code/lock.c>* */ |
| 74 | typedef struct PoolStruct *Pool; /* <design/pool/> */ | 72 | typedef struct PoolStruct *Pool; /* <design/pool/> */ |
| 75 | typedef struct PoolClassStruct *PoolClass; /* <code/poolclas.c> */ | 73 | typedef struct PoolClassStruct *PoolClass; /* <code/poolclas.c> */ |
| @@ -94,7 +92,7 @@ typedef struct SegPrefStruct *SegPref; /* design.mps.pref, <code/locus.c> */ | |||
| 94 | typedef int SegPrefKind; /* design.mps.pref, <code/locus.c> */ | 92 | typedef int SegPrefKind; /* design.mps.pref, <code/locus.c> */ |
| 95 | typedef struct ArenaClassStruct *ArenaClass; /* <design/arena/> */ | 93 | typedef struct ArenaClassStruct *ArenaClass; /* <design/arena/> */ |
| 96 | typedef ArenaClass AbstractArenaClass; /* <code/arena.c> */ | 94 | typedef ArenaClass AbstractArenaClass; /* <code/arena.c> */ |
| 97 | typedef struct ArenaStruct *Arena; /* <design/arena/> */ | 95 | typedef struct mps_arena_s *Arena; /* <design/arena/> */ |
| 98 | typedef struct GlobalsStruct *Globals; /* <design/arena/> */ | 96 | typedef struct GlobalsStruct *Globals; /* <design/arena/> */ |
| 99 | typedef struct VMStruct *VM; /* <code/vm.c>* */ | 97 | typedef struct VMStruct *VM; /* <code/vm.c>* */ |
| 100 | typedef struct RootStruct *Root; /* <code/root.c> */ | 98 | typedef struct RootStruct *Root; /* <code/root.c> */ |
diff --git a/mps/code/mps.h b/mps/code/mps.h index 8971c3a4f2d..c0d7a20286d 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h | |||
| @@ -1,11 +1,25 @@ | |||
| 1 | /* mps.h: RAVENBROOK MEMORY POOL SYSTEM C INTERFACE | 1 | /* mps.h: RAVENBROOK MEMORY POOL SYSTEM C INTERFACE |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license. |
| 5 | * Portions copyright (c) 2002 Global Graphics Software. | 5 | * Portions copyright (c) 2002 Global Graphics Software. |
| 6 | * | 6 | * |
| 7 | * .readership: customers, MPS developers. | 7 | * THIS HEADER IS NOT DOCUMENTATION. |
| 8 | * .sources: <design/interface-c/>. | 8 | * Please refer to the [MPS Manual](../manual/). |
| 9 | * | ||
| 10 | * But if you are a human reading this, please note: | ||
| 11 | * | ||
| 12 | * .naming: The MPS interface only uses identifiers beginning `mps_`, | ||
| 13 | * `MPS_` or `_mps_` and may use any identifiers with these prefixes in | ||
| 14 | * future. | ||
| 15 | * | ||
| 16 | * .naming.internal: Any idenfitier beginning with underscore is for | ||
| 17 | * internal use within the interface and may change or be withdrawn without | ||
| 18 | * warning. | ||
| 19 | * | ||
| 20 | * .readership: compilers, MPS developers. | ||
| 21 | * | ||
| 22 | * .sources: [The design of the MPS Interface to C](../design/interface-c). | ||
| 9 | */ | 23 | */ |
| 10 | 24 | ||
| 11 | #ifndef mps_h | 25 | #ifndef mps_h |
| @@ -85,16 +99,16 @@ enum { | |||
| 85 | * <code/mpmtypes.h#message.types> */ | 99 | * <code/mpmtypes.h#message.types> */ |
| 86 | /* Not meant to be used by clients, they should use the macros below. */ | 100 | /* Not meant to be used by clients, they should use the macros below. */ |
| 87 | enum { | 101 | enum { |
| 88 | MPS_MESSAGE_TYPE_FINALIZATION, | 102 | _mps_MESSAGE_TYPE_FINALIZATION, |
| 89 | MPS_MESSAGE_TYPE_GC, | 103 | _mps_MESSAGE_TYPE_GC, |
| 90 | MPS_MESSAGE_TYPE_GC_START | 104 | _mps_MESSAGE_TYPE_GC_START |
| 91 | }; | 105 | }; |
| 92 | 106 | ||
| 93 | /* Message Types | 107 | /* Message Types |
| 94 | * This is what clients should use. */ | 108 | * This is what clients should use. */ |
| 95 | #define mps_message_type_finalization() MPS_MESSAGE_TYPE_FINALIZATION | 109 | #define mps_message_type_finalization() _mps_MESSAGE_TYPE_FINALIZATION |
| 96 | #define mps_message_type_gc() MPS_MESSAGE_TYPE_GC | 110 | #define mps_message_type_gc() _mps_MESSAGE_TYPE_GC |
| 97 | #define mps_message_type_gc_start() MPS_MESSAGE_TYPE_GC_START | 111 | #define mps_message_type_gc_start() _mps_MESSAGE_TYPE_GC_START |
| 98 | 112 | ||
| 99 | 113 | ||
| 100 | /* Reference Ranks | 114 | /* Reference Ranks |
| @@ -105,11 +119,6 @@ extern mps_rank_t mps_rank_ambig(void); | |||
| 105 | extern mps_rank_t mps_rank_exact(void); | 119 | extern mps_rank_t mps_rank_exact(void); |
| 106 | extern mps_rank_t mps_rank_weak(void); | 120 | extern mps_rank_t mps_rank_weak(void); |
| 107 | 121 | ||
| 108 | /* These upper case symbolic forms are obsolescent. */ | ||
| 109 | /* Provided for source compatibility only. */ | ||
| 110 | #define MPS_RANK_AMBIG mps_rank_ambig() | ||
| 111 | #define MPS_RANK_EXACT mps_rank_exact() | ||
| 112 | #define MPS_RANK_WEAK mps_rank_weak() | ||
| 113 | 122 | ||
| 114 | /* Root Modes */ | 123 | /* Root Modes */ |
| 115 | /* .rm: Keep in sync with <code/mpmtypes.h#rm> */ | 124 | /* .rm: Keep in sync with <code/mpmtypes.h#rm> */ |
| @@ -125,9 +134,9 @@ typedef struct mps_ap_s { /* allocation point descriptor */ | |||
| 125 | mps_addr_t init; /* limit of initialized memory */ | 134 | mps_addr_t init; /* limit of initialized memory */ |
| 126 | mps_addr_t alloc; /* limit of allocated memory */ | 135 | mps_addr_t alloc; /* limit of allocated memory */ |
| 127 | mps_addr_t limit; /* limit of available memory */ | 136 | mps_addr_t limit; /* limit of available memory */ |
| 128 | mps_addr_t frameptr; /* lightweight frame pointer */ | 137 | mps_addr_t _frameptr; /* lightweight frame pointer */ |
| 129 | mps_bool_t enabled; /* lightweight frame status */ | 138 | mps_bool_t _enabled; /* lightweight frame status */ |
| 130 | mps_bool_t lwpoppending; /* lightweight pop pending? */ | 139 | mps_bool_t _lwpoppending; /* lightweight pop pending? */ |
| 131 | } mps_ap_s; | 140 | } mps_ap_s; |
| 132 | 141 | ||
| 133 | 142 | ||
| @@ -165,7 +174,7 @@ typedef struct mps_sac_class_s { | |||
| 165 | /* .ld: Keep in sync with <code/mpmst.h#ld.struct>. */ | 174 | /* .ld: Keep in sync with <code/mpmst.h#ld.struct>. */ |
| 166 | 175 | ||
| 167 | typedef struct mps_ld_s { /* location dependency descriptor */ | 176 | typedef struct mps_ld_s { /* location dependency descriptor */ |
| 168 | mps_word_t w0, w1; | 177 | mps_word_t _epoch, _rs; |
| 169 | } mps_ld_s; | 178 | } mps_ld_s; |
| 170 | 179 | ||
| 171 | 180 | ||
| @@ -186,10 +195,10 @@ typedef mps_addr_t (*mps_fmt_class_t)(mps_addr_t); | |||
| 186 | 195 | ||
| 187 | 196 | ||
| 188 | /* Scan State */ | 197 | /* Scan State */ |
| 189 | /* .ss: See also <code/mpsi.c#check.ss> and <code/mpmst.h#ss>. */ | 198 | /* .ss: See also <code/mpmst.h#ss>. */ |
| 190 | 199 | ||
| 191 | typedef struct mps_ss_s { | 200 | typedef struct mps_ss_s { |
| 192 | mps_word_t w0, w1, w2; | 201 | mps_word_t _zs, _w, _ufs; |
| 193 | } mps_ss_s; | 202 | } mps_ss_s; |
| 194 | 203 | ||
| 195 | 204 | ||
| @@ -629,20 +638,20 @@ extern mps_res_t mps_fix(mps_ss_t, mps_addr_t *); | |||
| 629 | #define MPS_SCAN_BEGIN(ss) \ | 638 | #define MPS_SCAN_BEGIN(ss) \ |
| 630 | MPS_BEGIN \ | 639 | MPS_BEGIN \ |
| 631 | mps_ss_t _ss = (ss); \ | 640 | mps_ss_t _ss = (ss); \ |
| 632 | mps_word_t _mps_w0 = (_ss)->w0; \ | 641 | mps_word_t _mps_zs = (_ss)->_zs; \ |
| 633 | mps_word_t _mps_w1 = (_ss)->w1; \ | 642 | mps_word_t _mps_w = (_ss)->_w; \ |
| 634 | mps_word_t _mps_w2 = (_ss)->w2; \ | 643 | mps_word_t _mps_ufs = (_ss)->_ufs; \ |
| 635 | mps_word_t _mps_wt; \ | 644 | mps_word_t _mps_wt; \ |
| 636 | { | 645 | { |
| 637 | 646 | ||
| 638 | #define MPS_FIX1(ss, ref) \ | 647 | #define MPS_FIX1(ss, ref) \ |
| 639 | (_mps_wt = (mps_word_t)1 << ((mps_word_t)(ref) >> _mps_w0 \ | 648 | (_mps_wt = (mps_word_t)1 << ((mps_word_t)(ref) >> _mps_zs \ |
| 640 | & (sizeof(mps_word_t) * CHAR_BIT - 1)), \ | 649 | & (sizeof(mps_word_t) * CHAR_BIT - 1)), \ |
| 641 | _mps_w2 |= _mps_wt, \ | 650 | _mps_ufs |= _mps_wt, \ |
| 642 | (_mps_w1 & _mps_wt) != 0) | 651 | (_mps_w & _mps_wt) != 0) |
| 643 | 652 | ||
| 644 | extern mps_res_t mps_fix2(mps_ss_t, mps_addr_t *); | 653 | extern mps_res_t _mps_fix2(mps_ss_t, mps_addr_t *); |
| 645 | #define MPS_FIX2(ss, ref_io) mps_fix2(ss, ref_io) | 654 | #define MPS_FIX2(ss, ref_io) _mps_fix2(ss, ref_io) |
| 646 | 655 | ||
| 647 | #define MPS_FIX12(ss, ref_io) \ | 656 | #define MPS_FIX12(ss, ref_io) \ |
| 648 | (MPS_FIX1(ss, *(ref_io)) ? \ | 657 | (MPS_FIX1(ss, *(ref_io)) ? \ |
| @@ -653,12 +662,12 @@ extern mps_res_t mps_fix2(mps_ss_t, mps_addr_t *); | |||
| 653 | 662 | ||
| 654 | #define MPS_FIX_CALL(ss, call) \ | 663 | #define MPS_FIX_CALL(ss, call) \ |
| 655 | MPS_BEGIN \ | 664 | MPS_BEGIN \ |
| 656 | (call); _mps_w2 |= (ss)->w2; \ | 665 | (call); _mps_ufs |= (ss)->_ufs; \ |
| 657 | MPS_END | 666 | MPS_END |
| 658 | 667 | ||
| 659 | #define MPS_SCAN_END(ss) \ | 668 | #define MPS_SCAN_END(ss) \ |
| 660 | } \ | 669 | } \ |
| 661 | (ss)->w2 = _mps_w2; \ | 670 | (ss)->_ufs = _mps_ufs; \ |
| 662 | MPS_END | 671 | MPS_END |
| 663 | 672 | ||
| 664 | 673 | ||
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 528ffebea3e..8b02e81e596 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c | |||
| @@ -83,25 +83,17 @@ static Bool mpsi_check(void) | |||
| 83 | CHECKL((int)MPS_RES_IO == (int)ResIO); | 83 | CHECKL((int)MPS_RES_IO == (int)ResIO); |
| 84 | CHECKL((int)MPS_RES_COMMIT_LIMIT == (int)ResCOMMIT_LIMIT); | 84 | CHECKL((int)MPS_RES_COMMIT_LIMIT == (int)ResCOMMIT_LIMIT); |
| 85 | 85 | ||
| 86 | /* Check that external and internal rank numbers match. */ | ||
| 87 | /* See <code/mps.h#ranks> and <code/mpmtypes.h#ranks>. */ | ||
| 88 | /* Also see .check.enum.cast. */ | ||
| 89 | CHECKL(COMPATTYPE(mps_rank_t, Rank)); | ||
| 90 | CHECKL((int)MPS_RANK_AMBIG == (int)RankAMBIG); | ||
| 91 | CHECKL((int)MPS_RANK_EXACT == (int)RankEXACT); | ||
| 92 | CHECKL((int)MPS_RANK_WEAK == (int)RankWEAK); | ||
| 93 | |||
| 94 | /* Check that external and internal message types match. */ | 86 | /* Check that external and internal message types match. */ |
| 95 | /* See <code/mps.h#message.types> and */ | 87 | /* See <code/mps.h#message.types> and */ |
| 96 | /* <code/mpmtypes.h#message.types>. */ | 88 | /* <code/mpmtypes.h#message.types>. */ |
| 97 | /* Also see .check.enum.cast. */ | 89 | /* Also see .check.enum.cast. */ |
| 98 | CHECKL(COMPATTYPE(mps_message_type_t, MessageType)); | 90 | CHECKL(COMPATTYPE(mps_message_type_t, MessageType)); |
| 99 | CHECKL((int)MessageTypeFINALIZATION | 91 | CHECKL((int)MessageTypeFINALIZATION |
| 100 | == (int)MPS_MESSAGE_TYPE_FINALIZATION); | 92 | == (int)_mps_MESSAGE_TYPE_FINALIZATION); |
| 101 | CHECKL((int)MessageTypeGC | 93 | CHECKL((int)MessageTypeGC |
| 102 | == (int)MPS_MESSAGE_TYPE_GC); | 94 | == (int)_mps_MESSAGE_TYPE_GC); |
| 103 | CHECKL((int)MessageTypeGCSTART | 95 | CHECKL((int)MessageTypeGCSTART |
| 104 | == (int)MPS_MESSAGE_TYPE_GC_START); | 96 | == (int)_mps_MESSAGE_TYPE_GC_START); |
| 105 | 97 | ||
| 106 | /* The external idea of a word width and the internal one */ | 98 | /* The external idea of a word width and the internal one */ |
| 107 | /* had better match. See <design/interface-c/#cons>. */ | 99 | /* had better match. See <design/interface-c/#cons>. */ |
| @@ -121,13 +113,6 @@ static Bool mpsi_check(void) | |||
| 121 | /* out to external. */ | 113 | /* out to external. */ |
| 122 | CHECKL(COMPATTYPE(mps_clock_t, Clock)); | 114 | CHECKL(COMPATTYPE(mps_clock_t, Clock)); |
| 123 | 115 | ||
| 124 | /* Check ap_s/APStruct compatibility by hand */ | ||
| 125 | /* .check.ap: See <code/mps.h#ap> and <code/buffer.h#ap>. */ | ||
| 126 | CHECKL(sizeof(mps_ap_s) == sizeof(APStruct)); | ||
| 127 | CHECKL(COMPATFIELD(mps_ap_s, init, APStruct, init)); | ||
| 128 | CHECKL(COMPATFIELD(mps_ap_s, alloc, APStruct, alloc)); | ||
| 129 | CHECKL(COMPATFIELD(mps_ap_s, limit, APStruct, limit)); | ||
| 130 | |||
| 131 | /* Check sac_s/ExternalSACStruct compatibility by hand */ | 116 | /* Check sac_s/ExternalSACStruct compatibility by hand */ |
| 132 | /* See <code/mps.h#sac> and <code/sac.h#sac>. */ | 117 | /* See <code/mps.h#sac> and <code/sac.h#sac>. */ |
| 133 | CHECKL(sizeof(mps_sac_s) == sizeof(ExternalSACStruct)); | 118 | CHECKL(sizeof(mps_sac_s) == sizeof(ExternalSACStruct)); |
| @@ -157,20 +142,6 @@ static Bool mpsi_check(void) | |||
| 157 | CHECKL(COMPATFIELD(mps_sac_classes_s, mps_frequency, | 142 | CHECKL(COMPATFIELD(mps_sac_classes_s, mps_frequency, |
| 158 | SACClassesStruct, frequency)); | 143 | SACClassesStruct, frequency)); |
| 159 | 144 | ||
| 160 | /* Check ss_s/ScanStateStruct compatibility by hand */ | ||
| 161 | /* .check.ss: See <code/mps.h#ss> and <code/mpmst.h#ss>. */ | ||
| 162 | /* Note that the size of the mps_ss_s and ScanStateStruct */ | ||
| 163 | /* are not equal. See <code/mpmst.h#ss>. */ | ||
| 164 | CHECKL(COMPATFIELD(mps_ss_s, w0, ScanStateStruct, zoneShift)); | ||
| 165 | CHECKL(COMPATFIELD(mps_ss_s, w1, ScanStateStruct, white)); | ||
| 166 | CHECKL(COMPATFIELD(mps_ss_s, w2, ScanStateStruct, unfixedSummary)); | ||
| 167 | |||
| 168 | /* Check ld_s/LDStruct compatibility by hand */ | ||
| 169 | /* .check.ld: See also <code/mpmst.h#ld.struct> and <code/mps.h#ld> */ | ||
| 170 | CHECKL(sizeof(mps_ld_s) == sizeof(LDStruct)); | ||
| 171 | CHECKL(COMPATFIELD(mps_ld_s, w0, LDStruct, epoch)); | ||
| 172 | CHECKL(COMPATFIELD(mps_ld_s, w1, LDStruct, rs)); | ||
| 173 | |||
| 174 | return TRUE; | 145 | return TRUE; |
| 175 | } | 146 | } |
| 176 | 147 | ||
| @@ -199,10 +170,9 @@ mps_rank_t mps_rank_weak(void) | |||
| 199 | } | 170 | } |
| 200 | 171 | ||
| 201 | 172 | ||
| 202 | mps_res_t mps_arena_extend(mps_arena_t mps_arena, | 173 | mps_res_t mps_arena_extend(mps_arena_t arena, |
| 203 | mps_addr_t base, size_t size) | 174 | mps_addr_t base, size_t size) |
| 204 | { | 175 | { |
| 205 | Arena arena = (Arena)mps_arena; | ||
| 206 | Res res; | 176 | Res res; |
| 207 | 177 | ||
| 208 | ArenaEnter(arena); | 178 | ArenaEnter(arena); |
| @@ -213,9 +183,8 @@ mps_res_t mps_arena_extend(mps_arena_t mps_arena, | |||
| 213 | return (mps_res_t)res; | 183 | return (mps_res_t)res; |
| 214 | } | 184 | } |
| 215 | 185 | ||
| 216 | size_t mps_arena_reserved(mps_arena_t mps_arena) | 186 | size_t mps_arena_reserved(mps_arena_t arena) |
| 217 | { | 187 | { |
| 218 | Arena arena = (Arena)mps_arena; | ||
| 219 | Size size; | 188 | Size size; |
| 220 | 189 | ||
| 221 | ArenaEnter(arena); | 190 | ArenaEnter(arena); |
| @@ -231,9 +200,8 @@ size_t mps_space_reserved(mps_space_t mps_space) | |||
| 231 | return mps_arena_reserved(mps_space); | 200 | return mps_arena_reserved(mps_space); |
| 232 | } | 201 | } |
| 233 | 202 | ||
| 234 | size_t mps_arena_committed(mps_arena_t mps_arena) | 203 | size_t mps_arena_committed(mps_arena_t arena) |
| 235 | { | 204 | { |
| 236 | Arena arena = (Arena)mps_arena; | ||
| 237 | Size size; | 205 | Size size; |
| 238 | 206 | ||
| 239 | ArenaEnter(arena); | 207 | ArenaEnter(arena); |
| @@ -249,9 +217,8 @@ size_t mps_space_committed(mps_space_t mps_space) | |||
| 249 | return mps_arena_committed(mps_space); | 217 | return mps_arena_committed(mps_space); |
| 250 | } | 218 | } |
| 251 | 219 | ||
| 252 | size_t mps_arena_spare_committed(mps_arena_t mps_arena) | 220 | size_t mps_arena_spare_committed(mps_arena_t arena) |
| 253 | { | 221 | { |
| 254 | Arena arena = (Arena)mps_arena; | ||
| 255 | Size size; | 222 | Size size; |
| 256 | 223 | ||
| 257 | ArenaEnter(arena); | 224 | ArenaEnter(arena); |
| @@ -261,9 +228,8 @@ size_t mps_arena_spare_committed(mps_arena_t mps_arena) | |||
| 261 | return (size_t)size; | 228 | return (size_t)size; |
| 262 | } | 229 | } |
| 263 | 230 | ||
| 264 | size_t mps_arena_commit_limit(mps_arena_t mps_arena) | 231 | size_t mps_arena_commit_limit(mps_arena_t arena) |
| 265 | { | 232 | { |
| 266 | Arena arena = (Arena)mps_arena; | ||
| 267 | Size size; | 233 | Size size; |
| 268 | 234 | ||
| 269 | ArenaEnter(arena); | 235 | ArenaEnter(arena); |
| @@ -273,10 +239,9 @@ size_t mps_arena_commit_limit(mps_arena_t mps_arena) | |||
| 273 | return size; | 239 | return size; |
| 274 | } | 240 | } |
| 275 | 241 | ||
| 276 | mps_res_t mps_arena_commit_limit_set(mps_arena_t mps_arena, size_t limit) | 242 | mps_res_t mps_arena_commit_limit_set(mps_arena_t arena, size_t limit) |
| 277 | { | 243 | { |
| 278 | Res res; | 244 | Res res; |
| 279 | Arena arena = (Arena)mps_arena; | ||
| 280 | 245 | ||
| 281 | ArenaEnter(arena); | 246 | ArenaEnter(arena); |
| 282 | res = ArenaSetCommitLimit(arena, limit); | 247 | res = ArenaSetCommitLimit(arena, limit); |
| @@ -285,10 +250,8 @@ mps_res_t mps_arena_commit_limit_set(mps_arena_t mps_arena, size_t limit) | |||
| 285 | return res; | 250 | return res; |
| 286 | } | 251 | } |
| 287 | 252 | ||
| 288 | void mps_arena_spare_commit_limit_set(mps_arena_t mps_arena, size_t limit) | 253 | void mps_arena_spare_commit_limit_set(mps_arena_t arena, size_t limit) |
| 289 | { | 254 | { |
| 290 | Arena arena = (Arena)mps_arena; | ||
| 291 | |||
| 292 | ArenaEnter(arena); | 255 | ArenaEnter(arena); |
| 293 | ArenaSetSpareCommitLimit(arena, limit); | 256 | ArenaSetSpareCommitLimit(arena, limit); |
| 294 | ArenaLeave(arena); | 257 | ArenaLeave(arena); |
| @@ -296,9 +259,8 @@ void mps_arena_spare_commit_limit_set(mps_arena_t mps_arena, size_t limit) | |||
| 296 | return; | 259 | return; |
| 297 | } | 260 | } |
| 298 | 261 | ||
| 299 | size_t mps_arena_spare_commit_limit(mps_arena_t mps_arena) | 262 | size_t mps_arena_spare_commit_limit(mps_arena_t arena) |
| 300 | { | 263 | { |
| 301 | Arena arena = (Arena)mps_arena; | ||
| 302 | size_t limit; | 264 | size_t limit; |
| 303 | 265 | ||
| 304 | ArenaEnter(arena); | 266 | ArenaEnter(arena); |
| @@ -308,9 +270,8 @@ size_t mps_arena_spare_commit_limit(mps_arena_t mps_arena) | |||
| 308 | return limit; | 270 | return limit; |
| 309 | } | 271 | } |
| 310 | 272 | ||
| 311 | void mps_arena_clamp(mps_arena_t mps_arena) | 273 | void mps_arena_clamp(mps_arena_t arena) |
| 312 | { | 274 | { |
| 313 | Arena arena = (Arena)mps_arena; | ||
| 314 | ArenaEnter(arena); | 275 | ArenaEnter(arena); |
| 315 | ArenaClamp(ArenaGlobals(arena)); | 276 | ArenaClamp(ArenaGlobals(arena)); |
| 316 | ArenaLeave(arena); | 277 | ArenaLeave(arena); |
| @@ -323,9 +284,8 @@ void mps_space_clamp(mps_space_t mps_space) | |||
| 323 | } | 284 | } |
| 324 | 285 | ||
| 325 | 286 | ||
| 326 | void mps_arena_release(mps_arena_t mps_arena) | 287 | void mps_arena_release(mps_arena_t arena) |
| 327 | { | 288 | { |
| 328 | Arena arena = (Arena)mps_arena; | ||
| 329 | ArenaEnter(arena); | 289 | ArenaEnter(arena); |
| 330 | ArenaRelease(ArenaGlobals(arena)); | 290 | ArenaRelease(ArenaGlobals(arena)); |
| 331 | ArenaLeave(arena); | 291 | ArenaLeave(arena); |
| @@ -352,26 +312,23 @@ void mps_space_park(mps_space_t mps_space) | |||
| 352 | mps_arena_park(mps_space); | 312 | mps_arena_park(mps_space); |
| 353 | } | 313 | } |
| 354 | 314 | ||
| 355 | void mps_arena_expose(mps_arena_t mps_arena) | 315 | void mps_arena_expose(mps_arena_t arena) |
| 356 | { | 316 | { |
| 357 | Arena arena = (Arena)mps_arena; | ||
| 358 | ArenaEnter(arena); | 317 | ArenaEnter(arena); |
| 359 | ArenaExposeRemember(ArenaGlobals(arena), 0); | 318 | ArenaExposeRemember(ArenaGlobals(arena), 0); |
| 360 | ArenaLeave(arena); | 319 | ArenaLeave(arena); |
| 361 | } | 320 | } |
| 362 | 321 | ||
| 363 | /* Null implementations of remember and restore */ | 322 | /* Null implementations of remember and restore */ |
| 364 | void mps_arena_unsafe_expose_remember_protection(mps_arena_t mps_arena) | 323 | void mps_arena_unsafe_expose_remember_protection(mps_arena_t arena) |
| 365 | { | 324 | { |
| 366 | Arena arena = (Arena)mps_arena; | ||
| 367 | ArenaEnter(arena); | 325 | ArenaEnter(arena); |
| 368 | ArenaExposeRemember(ArenaGlobals(arena), 1); | 326 | ArenaExposeRemember(ArenaGlobals(arena), 1); |
| 369 | ArenaLeave(arena); | 327 | ArenaLeave(arena); |
| 370 | } | 328 | } |
| 371 | 329 | ||
| 372 | void mps_arena_unsafe_restore_protection(mps_arena_t mps_arena) | 330 | void mps_arena_unsafe_restore_protection(mps_arena_t arena) |
| 373 | { | 331 | { |
| 374 | Arena arena = (Arena)mps_arena; | ||
| 375 | ArenaEnter(arena); | 332 | ArenaEnter(arena); |
| 376 | ArenaRestoreProtection(ArenaGlobals(arena)); | 333 | ArenaRestoreProtection(ArenaGlobals(arena)); |
| 377 | ArenaLeave(arena); | 334 | ArenaLeave(arena); |
| @@ -398,12 +355,11 @@ mps_res_t mps_arena_collect(mps_space_t mps_space) | |||
| 398 | return res; | 355 | return res; |
| 399 | } | 356 | } |
| 400 | 357 | ||
| 401 | mps_bool_t mps_arena_step(mps_arena_t mps_arena, | 358 | mps_bool_t mps_arena_step(mps_arena_t arena, |
| 402 | double interval, | 359 | double interval, |
| 403 | double multiplier) | 360 | double multiplier) |
| 404 | { | 361 | { |
| 405 | Bool b; | 362 | Bool b; |
| 406 | Arena arena = (Arena)mps_arena; | ||
| 407 | ArenaEnter(arena); | 363 | ArenaEnter(arena); |
| 408 | b = ArenaStep(ArenaGlobals(arena), interval, multiplier); | 364 | b = ArenaStep(ArenaGlobals(arena), interval, multiplier); |
| 409 | ArenaLeave(arena); | 365 | ArenaLeave(arena); |
| @@ -457,10 +413,8 @@ mps_res_t mps_arena_create_v(mps_arena_t *mps_arena_o, | |||
| 457 | 413 | ||
| 458 | /* mps_arena_destroy -- destroy an arena object */ | 414 | /* mps_arena_destroy -- destroy an arena object */ |
| 459 | 415 | ||
| 460 | void mps_arena_destroy(mps_arena_t mps_arena) | 416 | void mps_arena_destroy(mps_arena_t arena) |
| 461 | { | 417 | { |
| 462 | Arena arena = (Arena)mps_arena; | ||
| 463 | |||
| 464 | ArenaEnter(arena); | 418 | ArenaEnter(arena); |
| 465 | ArenaDestroy(arena); | 419 | ArenaDestroy(arena); |
| 466 | } | 420 | } |
| @@ -468,10 +422,9 @@ void mps_arena_destroy(mps_arena_t mps_arena) | |||
| 468 | 422 | ||
| 469 | /* mps_arena_has_addr -- is this address managed by this arena? */ | 423 | /* mps_arena_has_addr -- is this address managed by this arena? */ |
| 470 | 424 | ||
| 471 | mps_bool_t mps_arena_has_addr(mps_arena_t mps_arena, mps_addr_t p) | 425 | mps_bool_t mps_arena_has_addr(mps_arena_t arena, mps_addr_t p) |
| 472 | { | 426 | { |
| 473 | Bool b; | 427 | Bool b; |
| 474 | Arena arena = (Arena)mps_arena; | ||
| 475 | 428 | ||
| 476 | /* One of the few functions that can be called | 429 | /* One of the few functions that can be called |
| 477 | during the call to an MPS function. IE this function | 430 | during the call to an MPS function. IE this function |
| @@ -490,12 +443,11 @@ mps_bool_t mps_arena_has_addr(mps_arena_t mps_arena, mps_addr_t p) | |||
| 490 | */ | 443 | */ |
| 491 | 444 | ||
| 492 | mps_bool_t mps_addr_pool(mps_pool_t *mps_pool_o, | 445 | mps_bool_t mps_addr_pool(mps_pool_t *mps_pool_o, |
| 493 | mps_arena_t mps_arena, | 446 | mps_arena_t arena, |
| 494 | mps_addr_t p) | 447 | mps_addr_t p) |
| 495 | { | 448 | { |
| 496 | Bool b; | 449 | Bool b; |
| 497 | Pool pool; | 450 | Pool pool; |
| 498 | Arena arena = (Arena)mps_arena; | ||
| 499 | 451 | ||
| 500 | AVER(mps_pool_o != NULL); | 452 | AVER(mps_pool_o != NULL); |
| 501 | /* mps_arena -- will be checked by ArenaEnterRecursive */ | 453 | /* mps_arena -- will be checked by ArenaEnterRecursive */ |
| @@ -528,13 +480,12 @@ mps_bool_t mps_addr_pool(mps_pool_t *mps_pool_o, | |||
| 528 | * Note: may return an MPS-internal format. | 480 | * Note: may return an MPS-internal format. |
| 529 | */ | 481 | */ |
| 530 | mps_bool_t mps_addr_fmt(mps_fmt_t *mps_fmt_o, | 482 | mps_bool_t mps_addr_fmt(mps_fmt_t *mps_fmt_o, |
| 531 | mps_arena_t mps_arena, | 483 | mps_arena_t arena, |
| 532 | mps_addr_t p) | 484 | mps_addr_t p) |
| 533 | { | 485 | { |
| 534 | Bool b; | 486 | Bool b; |
| 535 | Pool pool; | 487 | Pool pool; |
| 536 | Format format = 0; | 488 | Format format = 0; |
| 537 | Arena arena = (Arena)mps_arena; | ||
| 538 | 489 | ||
| 539 | AVER(mps_fmt_o != NULL); | 490 | AVER(mps_fmt_o != NULL); |
| 540 | /* mps_arena -- will be checked by ArenaEnterRecursive */ | 491 | /* mps_arena -- will be checked by ArenaEnterRecursive */ |
| @@ -565,10 +516,9 @@ mps_bool_t mps_addr_fmt(mps_fmt_t *mps_fmt_o, | |||
| 565 | * the format structure is declared as "mps_fmt_A". */ | 516 | * the format structure is declared as "mps_fmt_A". */ |
| 566 | 517 | ||
| 567 | mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o, | 518 | mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o, |
| 568 | mps_arena_t mps_arena, | 519 | mps_arena_t arena, |
| 569 | mps_fmt_A_s *mps_fmt_A) | 520 | mps_fmt_A_s *mps_fmt_A) |
| 570 | { | 521 | { |
| 571 | Arena arena = (Arena)mps_arena; | ||
| 572 | Format format; | 522 | Format format; |
| 573 | Res res; | 523 | Res res; |
| 574 | 524 | ||
| @@ -600,10 +550,9 @@ mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o, | |||
| 600 | /* mps_fmt_create_B -- create an object format of variant B */ | 550 | /* mps_fmt_create_B -- create an object format of variant B */ |
| 601 | 551 | ||
| 602 | mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o, | 552 | mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o, |
| 603 | mps_arena_t mps_arena, | 553 | mps_arena_t arena, |
| 604 | mps_fmt_B_s *mps_fmt_B) | 554 | mps_fmt_B_s *mps_fmt_B) |
| 605 | { | 555 | { |
| 606 | Arena arena = (Arena)mps_arena; | ||
| 607 | Format format; | 556 | Format format; |
| 608 | Res res; | 557 | Res res; |
| 609 | 558 | ||
| @@ -635,10 +584,9 @@ mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o, | |||
| 635 | /* mps_fmt_create_auto_header -- create a format of variant auto_header */ | 584 | /* mps_fmt_create_auto_header -- create a format of variant auto_header */ |
| 636 | 585 | ||
| 637 | mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o, | 586 | mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o, |
| 638 | mps_arena_t mps_arena, | 587 | mps_arena_t arena, |
| 639 | mps_fmt_auto_header_s *mps_fmt) | 588 | mps_fmt_auto_header_s *mps_fmt) |
| 640 | { | 589 | { |
| 641 | Arena arena = (Arena)mps_arena; | ||
| 642 | Format format; | 590 | Format format; |
| 643 | Res res; | 591 | Res res; |
| 644 | 592 | ||
| @@ -670,10 +618,9 @@ mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o, | |||
| 670 | /* mps_fmt_create_fixed -- create an object format of variant fixed */ | 618 | /* mps_fmt_create_fixed -- create an object format of variant fixed */ |
| 671 | 619 | ||
| 672 | mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o, | 620 | mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o, |
| 673 | mps_arena_t mps_arena, | 621 | mps_arena_t arena, |
| 674 | mps_fmt_fixed_s *mps_fmt_fixed) | 622 | mps_fmt_fixed_s *mps_fmt_fixed) |
| 675 | { | 623 | { |
| 676 | Arena arena = (Arena)mps_arena; | ||
| 677 | Format format; | 624 | Format format; |
| 678 | Res res; | 625 | Res res; |
| 679 | 626 | ||
| @@ -720,21 +667,20 @@ void mps_fmt_destroy(mps_fmt_t mps_fmt) | |||
| 720 | } | 667 | } |
| 721 | 668 | ||
| 722 | 669 | ||
| 723 | mps_res_t mps_pool_create(mps_pool_t *mps_pool_o, mps_arena_t mps_arena, | 670 | mps_res_t mps_pool_create(mps_pool_t *mps_pool_o, mps_arena_t arena, |
| 724 | mps_class_t mps_class, ...) | 671 | mps_class_t mps_class, ...) |
| 725 | { | 672 | { |
| 726 | mps_res_t res; | 673 | mps_res_t res; |
| 727 | va_list args; | 674 | va_list args; |
| 728 | va_start(args, mps_class); | 675 | va_start(args, mps_class); |
| 729 | res = mps_pool_create_v(mps_pool_o, mps_arena, mps_class, args); | 676 | res = mps_pool_create_v(mps_pool_o, arena, mps_class, args); |
| 730 | va_end(args); | 677 | va_end(args); |
| 731 | return res; | 678 | return res; |
| 732 | } | 679 | } |
| 733 | 680 | ||
| 734 | mps_res_t mps_pool_create_v(mps_pool_t *mps_pool_o, mps_arena_t mps_arena, | 681 | mps_res_t mps_pool_create_v(mps_pool_t *mps_pool_o, mps_arena_t arena, |
| 735 | mps_class_t mps_class, va_list args) | 682 | mps_class_t mps_class, va_list args) |
| 736 | { | 683 | { |
| 737 | Arena arena = (Arena)mps_arena; | ||
| 738 | Pool pool; | 684 | Pool pool; |
| 739 | PoolClass class = (PoolClass)mps_class; | 685 | PoolClass class = (PoolClass)mps_class; |
| 740 | Res res; | 686 | Res res; |
| @@ -863,7 +809,7 @@ mps_res_t mps_ap_create(mps_ap_t *mps_ap_o, mps_pool_t mps_pool, ...) | |||
| 863 | 809 | ||
| 864 | if (res != ResOK) | 810 | if (res != ResOK) |
| 865 | return res; | 811 | return res; |
| 866 | *mps_ap_o = (mps_ap_t)BufferAP(buf); | 812 | *mps_ap_o = BufferAP(buf); |
| 867 | return MPS_RES_OK; | 813 | return MPS_RES_OK; |
| 868 | } | 814 | } |
| 869 | 815 | ||
| @@ -894,13 +840,13 @@ mps_res_t mps_ap_create_v(mps_ap_t *mps_ap_o, mps_pool_t mps_pool, | |||
| 894 | 840 | ||
| 895 | if (res != ResOK) | 841 | if (res != ResOK) |
| 896 | return res; | 842 | return res; |
| 897 | *mps_ap_o = (mps_ap_t)BufferAP(buf); | 843 | *mps_ap_o = BufferAP(buf); |
| 898 | return MPS_RES_OK; | 844 | return MPS_RES_OK; |
| 899 | } | 845 | } |
| 900 | 846 | ||
| 901 | void mps_ap_destroy(mps_ap_t mps_ap) | 847 | void mps_ap_destroy(mps_ap_t mps_ap) |
| 902 | { | 848 | { |
| 903 | Buffer buf = BufferOfAP((AP)mps_ap); | 849 | Buffer buf = BufferOfAP(mps_ap); |
| 904 | Arena arena; | 850 | Arena arena; |
| 905 | 851 | ||
| 906 | AVER(mps_ap != NULL); | 852 | AVER(mps_ap != NULL); |
| @@ -928,7 +874,7 @@ mps_res_t (mps_reserve)(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size) | |||
| 928 | 874 | ||
| 929 | AVER(p_o != NULL); | 875 | AVER(p_o != NULL); |
| 930 | AVER(mps_ap != NULL); | 876 | AVER(mps_ap != NULL); |
| 931 | AVER(TESTT(Buffer, BufferOfAP((AP)mps_ap))); | 877 | AVER(TESTT(Buffer, BufferOfAP(mps_ap))); |
| 932 | AVER(mps_ap->init == mps_ap->alloc); | 878 | AVER(mps_ap->init == mps_ap->alloc); |
| 933 | AVER(size > 0); | 879 | AVER(size > 0); |
| 934 | 880 | ||
| @@ -947,7 +893,7 @@ mps_res_t mps_reserve_with_reservoir_permit(mps_addr_t *p_o, | |||
| 947 | AVER(p_o != NULL); | 893 | AVER(p_o != NULL); |
| 948 | AVER(size > 0); | 894 | AVER(size > 0); |
| 949 | AVER(mps_ap != NULL); | 895 | AVER(mps_ap != NULL); |
| 950 | AVER(TESTT(Buffer, BufferOfAP((AP)mps_ap))); | 896 | AVER(TESTT(Buffer, BufferOfAP(mps_ap))); |
| 951 | AVER(mps_ap->init == mps_ap->alloc); | 897 | AVER(mps_ap->init == mps_ap->alloc); |
| 952 | 898 | ||
| 953 | MPS_RESERVE_WITH_RESERVOIR_PERMIT_BLOCK(res, *p_o, mps_ap, size); | 899 | MPS_RESERVE_WITH_RESERVOIR_PERMIT_BLOCK(res, *p_o, mps_ap, size); |
| @@ -968,7 +914,7 @@ mps_res_t mps_reserve_with_reservoir_permit(mps_addr_t *p_o, | |||
| 968 | mps_bool_t (mps_commit)(mps_ap_t mps_ap, mps_addr_t p, size_t size) | 914 | mps_bool_t (mps_commit)(mps_ap_t mps_ap, mps_addr_t p, size_t size) |
| 969 | { | 915 | { |
| 970 | AVER(mps_ap != NULL); | 916 | AVER(mps_ap != NULL); |
| 971 | AVER(TESTT(Buffer, BufferOfAP((AP)mps_ap))); | 917 | AVER(TESTT(Buffer, BufferOfAP(mps_ap))); |
| 972 | AVER(p != NULL); | 918 | AVER(p != NULL); |
| 973 | AVER(size > 0); | 919 | AVER(size > 0); |
| 974 | AVER(p == mps_ap->init); | 920 | AVER(p == mps_ap->init); |
| @@ -999,13 +945,13 @@ mps_res_t (mps_ap_frame_push)(mps_frame_t *frame_o, mps_ap_t mps_ap) | |||
| 999 | return MPS_RES_FAIL; | 945 | return MPS_RES_FAIL; |
| 1000 | } | 946 | } |
| 1001 | 947 | ||
| 1002 | if (!mps_ap->lwpoppending) { | 948 | if (!mps_ap->_lwpoppending) { |
| 1003 | /* Valid state for a lightweight push */ | 949 | /* Valid state for a lightweight push */ |
| 1004 | *frame_o = (mps_frame_t)mps_ap->init; | 950 | *frame_o = (mps_frame_t)mps_ap->init; |
| 1005 | return MPS_RES_OK; | 951 | return MPS_RES_OK; |
| 1006 | } else { | 952 | } else { |
| 1007 | /* Need a heavyweight push */ | 953 | /* Need a heavyweight push */ |
| 1008 | Buffer buf = BufferOfAP((AP)mps_ap); | 954 | Buffer buf = BufferOfAP(mps_ap); |
| 1009 | Arena arena; | 955 | Arena arena; |
| 1010 | AllocFrame frame; | 956 | AllocFrame frame; |
| 1011 | Res res; | 957 | Res res; |
| @@ -1040,16 +986,16 @@ mps_res_t (mps_ap_frame_pop)(mps_ap_t mps_ap, mps_frame_t frame) | |||
| 1040 | return MPS_RES_FAIL; | 986 | return MPS_RES_FAIL; |
| 1041 | } | 987 | } |
| 1042 | 988 | ||
| 1043 | if (mps_ap->enabled) { | 989 | if (mps_ap->_enabled) { |
| 1044 | /* Valid state for a lightweight pop */ | 990 | /* Valid state for a lightweight pop */ |
| 1045 | mps_ap->frameptr = (mps_addr_t)frame; /* record pending pop */ | 991 | mps_ap->_frameptr = (mps_addr_t)frame; /* record pending pop */ |
| 1046 | mps_ap->lwpoppending = TRUE; | 992 | mps_ap->_lwpoppending = TRUE; |
| 1047 | mps_ap->limit = (mps_addr_t)0; /* trap the buffer */ | 993 | mps_ap->limit = (mps_addr_t)0; /* trap the buffer */ |
| 1048 | return MPS_RES_OK; | 994 | return MPS_RES_OK; |
| 1049 | 995 | ||
| 1050 | } else { | 996 | } else { |
| 1051 | /* Need a heavyweight pop */ | 997 | /* Need a heavyweight pop */ |
| 1052 | Buffer buf = BufferOfAP((AP)mps_ap); | 998 | Buffer buf = BufferOfAP(mps_ap); |
| 1053 | Arena arena; | 999 | Arena arena; |
| 1054 | Res res; | 1000 | Res res; |
| 1055 | 1001 | ||
| @@ -1074,7 +1020,7 @@ mps_res_t (mps_ap_frame_pop)(mps_ap_t mps_ap, mps_frame_t frame) | |||
| 1074 | 1020 | ||
| 1075 | mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size) | 1021 | mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size) |
| 1076 | { | 1022 | { |
| 1077 | Buffer buf = BufferOfAP((AP)mps_ap); | 1023 | Buffer buf = BufferOfAP(mps_ap); |
| 1078 | Arena arena; | 1024 | Arena arena; |
| 1079 | Addr p; | 1025 | Addr p; |
| 1080 | Res res; | 1026 | Res res; |
| @@ -1105,7 +1051,7 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size) | |||
| 1105 | mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o, mps_ap_t mps_ap, | 1051 | mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o, mps_ap_t mps_ap, |
| 1106 | size_t size) | 1052 | size_t size) |
| 1107 | { | 1053 | { |
| 1108 | Buffer buf = BufferOfAP((AP)mps_ap); | 1054 | Buffer buf = BufferOfAP(mps_ap); |
| 1109 | Arena arena; | 1055 | Arena arena; |
| 1110 | Addr p; | 1056 | Addr p; |
| 1111 | Res res; | 1057 | Res res; |
| @@ -1140,7 +1086,7 @@ mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o, mps_ap_t mps_ap, | |||
| 1140 | 1086 | ||
| 1141 | mps_bool_t mps_ap_trip(mps_ap_t mps_ap, mps_addr_t p, size_t size) | 1087 | mps_bool_t mps_ap_trip(mps_ap_t mps_ap, mps_addr_t p, size_t size) |
| 1142 | { | 1088 | { |
| 1143 | Buffer buf = BufferOfAP((AP)mps_ap); | 1089 | Buffer buf = BufferOfAP(mps_ap); |
| 1144 | Arena arena; | 1090 | Arena arena; |
| 1145 | Bool b; | 1091 | Bool b; |
| 1146 | 1092 | ||
| @@ -1301,11 +1247,10 @@ void mps_sac_free(mps_sac_t mps_sac, mps_addr_t p, size_t size) | |||
| 1301 | /* Roots */ | 1247 | /* Roots */ |
| 1302 | 1248 | ||
| 1303 | 1249 | ||
| 1304 | mps_res_t mps_root_create(mps_root_t *mps_root_o, mps_arena_t mps_arena, | 1250 | mps_res_t mps_root_create(mps_root_t *mps_root_o, mps_arena_t arena, |
| 1305 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1251 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1306 | mps_root_scan_t mps_root_scan, void *p, size_t s) | 1252 | mps_root_scan_t mps_root_scan, void *p, size_t s) |
| 1307 | { | 1253 | { |
| 1308 | Arena arena = (Arena)mps_arena; | ||
| 1309 | Rank rank = (Rank)mps_rank; | 1254 | Rank rank = (Rank)mps_rank; |
| 1310 | Root root; | 1255 | Root root; |
| 1311 | Res res; | 1256 | Res res; |
| @@ -1326,11 +1271,10 @@ mps_res_t mps_root_create(mps_root_t *mps_root_o, mps_arena_t mps_arena, | |||
| 1326 | return MPS_RES_OK; | 1271 | return MPS_RES_OK; |
| 1327 | } | 1272 | } |
| 1328 | 1273 | ||
| 1329 | mps_res_t mps_root_create_table(mps_root_t *mps_root_o, mps_arena_t mps_arena, | 1274 | mps_res_t mps_root_create_table(mps_root_t *mps_root_o, mps_arena_t arena, |
| 1330 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1275 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1331 | mps_addr_t *base, size_t size) | 1276 | mps_addr_t *base, size_t size) |
| 1332 | { | 1277 | { |
| 1333 | Arena arena = (Arena)mps_arena; | ||
| 1334 | Rank rank = (Rank)mps_rank; | 1278 | Rank rank = (Rank)mps_rank; |
| 1335 | Root root; | 1279 | Root root; |
| 1336 | RootMode mode = (RootMode)mps_rm; | 1280 | RootMode mode = (RootMode)mps_rm; |
| @@ -1357,12 +1301,11 @@ mps_res_t mps_root_create_table(mps_root_t *mps_root_o, mps_arena_t mps_arena, | |||
| 1357 | } | 1301 | } |
| 1358 | 1302 | ||
| 1359 | mps_res_t mps_root_create_table_masked(mps_root_t *mps_root_o, | 1303 | mps_res_t mps_root_create_table_masked(mps_root_t *mps_root_o, |
| 1360 | mps_arena_t mps_arena, | 1304 | mps_arena_t arena, |
| 1361 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1305 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1362 | mps_addr_t *base, size_t size, | 1306 | mps_addr_t *base, size_t size, |
| 1363 | mps_word_t mask) | 1307 | mps_word_t mask) |
| 1364 | { | 1308 | { |
| 1365 | Arena arena = (Arena)mps_arena; | ||
| 1366 | Rank rank = (Rank)mps_rank; | 1309 | Rank rank = (Rank)mps_rank; |
| 1367 | Root root; | 1310 | Root root; |
| 1368 | RootMode mode = (RootMode)mps_rm; | 1311 | RootMode mode = (RootMode)mps_rm; |
| @@ -1388,12 +1331,11 @@ mps_res_t mps_root_create_table_masked(mps_root_t *mps_root_o, | |||
| 1388 | return MPS_RES_OK; | 1331 | return MPS_RES_OK; |
| 1389 | } | 1332 | } |
| 1390 | 1333 | ||
| 1391 | mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t mps_arena, | 1334 | mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t arena, |
| 1392 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1335 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1393 | mps_fmt_scan_t mps_fmt_scan, | 1336 | mps_fmt_scan_t mps_fmt_scan, |
| 1394 | mps_addr_t base, mps_addr_t limit) | 1337 | mps_addr_t base, mps_addr_t limit) |
| 1395 | { | 1338 | { |
| 1396 | Arena arena = (Arena)mps_arena; | ||
| 1397 | Rank rank = (Rank)mps_rank; | 1339 | Rank rank = (Rank)mps_rank; |
| 1398 | FormatScanMethod scan = (FormatScanMethod)mps_fmt_scan; | 1340 | FormatScanMethod scan = (FormatScanMethod)mps_fmt_scan; |
| 1399 | Root root; | 1341 | Root root; |
| @@ -1412,12 +1354,11 @@ mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t mps_arena, | |||
| 1412 | return MPS_RES_OK; | 1354 | return MPS_RES_OK; |
| 1413 | } | 1355 | } |
| 1414 | 1356 | ||
| 1415 | mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t mps_arena, | 1357 | mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t arena, |
| 1416 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1358 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1417 | mps_thr_t mps_thr, mps_reg_scan_t mps_reg_scan, | 1359 | mps_thr_t mps_thr, mps_reg_scan_t mps_reg_scan, |
| 1418 | void *reg_scan_p, size_t mps_size) | 1360 | void *reg_scan_p, size_t mps_size) |
| 1419 | { | 1361 | { |
| 1420 | Arena arena = (Arena)mps_arena; | ||
| 1421 | Rank rank = (Rank)mps_rank; | 1362 | Rank rank = (Rank)mps_rank; |
| 1422 | Thread thread = (Thread)mps_thr; | 1363 | Thread thread = (Thread)mps_thr; |
| 1423 | Root root; | 1364 | Root root; |
| @@ -1429,7 +1370,7 @@ mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t mps_arena, | |||
| 1429 | AVER(mps_reg_scan != NULL); | 1370 | AVER(mps_reg_scan != NULL); |
| 1430 | AVER(mps_reg_scan == mps_stack_scan_ambig); /* .reg.scan */ | 1371 | AVER(mps_reg_scan == mps_stack_scan_ambig); /* .reg.scan */ |
| 1431 | AVER(reg_scan_p != NULL); /* stackBot */ | 1372 | AVER(reg_scan_p != NULL); /* stackBot */ |
| 1432 | AVER(rank == MPS_RANK_AMBIG); | 1373 | AVER(rank == mps_rank_ambig()); |
| 1433 | AVER(mps_rm == (mps_rm_t)0); | 1374 | AVER(mps_rm == (mps_rm_t)0); |
| 1434 | 1375 | ||
| 1435 | /* See .root-mode. */ | 1376 | /* See .root-mode. */ |
| @@ -1452,9 +1393,8 @@ mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t mps_arena, | |||
| 1452 | mps_res_t mps_stack_scan_ambig(mps_ss_t mps_ss, | 1393 | mps_res_t mps_stack_scan_ambig(mps_ss_t mps_ss, |
| 1453 | mps_thr_t mps_thr, void *p, size_t s) | 1394 | mps_thr_t mps_thr, void *p, size_t s) |
| 1454 | { | 1395 | { |
| 1455 | ScanState ss = (ScanState)mps_ss; | 1396 | ScanState ss = PARENT(ScanStateStruct, ss_s, mps_ss); |
| 1456 | Thread thread = (Thread)mps_thr; | 1397 | Thread thread = (Thread)mps_thr; |
| 1457 | |||
| 1458 | UNUSED(s); | 1398 | UNUSED(s); |
| 1459 | return ThreadScan(ss, thread, p); | 1399 | return ThreadScan(ss, thread, p); |
| 1460 | } | 1400 | } |
| @@ -1487,9 +1427,8 @@ void (mps_tramp)(void **r_o, | |||
| 1487 | } | 1427 | } |
| 1488 | 1428 | ||
| 1489 | 1429 | ||
| 1490 | mps_res_t mps_thread_reg(mps_thr_t *mps_thr_o, mps_arena_t mps_arena) | 1430 | mps_res_t mps_thread_reg(mps_thr_t *mps_thr_o, mps_arena_t arena) |
| 1491 | { | 1431 | { |
| 1492 | Arena arena = (Arena)mps_arena; | ||
| 1493 | Thread thread; | 1432 | Thread thread; |
| 1494 | Res res; | 1433 | Res res; |
| 1495 | 1434 | ||
| @@ -1522,15 +1461,10 @@ void mps_thread_dereg(mps_thr_t mps_thr) | |||
| 1522 | ArenaLeave(arena); | 1461 | ArenaLeave(arena); |
| 1523 | } | 1462 | } |
| 1524 | 1463 | ||
| 1525 | void mps_ld_reset(mps_ld_t mps_ld, mps_arena_t mps_arena) | 1464 | void mps_ld_reset(mps_ld_t ld, mps_arena_t arena) |
| 1526 | { | 1465 | { |
| 1527 | Arena arena = (Arena)mps_arena; | ||
| 1528 | LD ld = (LD)mps_ld; | ||
| 1529 | |||
| 1530 | ArenaEnter(arena); | 1466 | ArenaEnter(arena); |
| 1531 | |||
| 1532 | LDReset(ld, arena); | 1467 | LDReset(ld, arena); |
| 1533 | |||
| 1534 | ArenaLeave(arena); | 1468 | ArenaLeave(arena); |
| 1535 | } | 1469 | } |
| 1536 | 1470 | ||
| @@ -1539,11 +1473,8 @@ void mps_ld_reset(mps_ld_t mps_ld, mps_arena_t mps_arena) | |||
| 1539 | * | 1473 | * |
| 1540 | * See <design/interface-c/#lock-free>. */ | 1474 | * See <design/interface-c/#lock-free>. */ |
| 1541 | 1475 | ||
| 1542 | void mps_ld_add(mps_ld_t mps_ld, mps_arena_t mps_arena, mps_addr_t addr) | 1476 | void mps_ld_add(mps_ld_t ld, mps_arena_t arena, mps_addr_t addr) |
| 1543 | { | 1477 | { |
| 1544 | Arena arena = (Arena)mps_arena; | ||
| 1545 | LD ld = (LD)mps_ld; | ||
| 1546 | |||
| 1547 | LDAdd(ld, arena, (Addr)addr); | 1478 | LDAdd(ld, arena, (Addr)addr); |
| 1548 | } | 1479 | } |
| 1549 | 1480 | ||
| @@ -1552,13 +1483,9 @@ void mps_ld_add(mps_ld_t mps_ld, mps_arena_t mps_arena, mps_addr_t addr) | |||
| 1552 | * | 1483 | * |
| 1553 | * See <design/interface-c/#lock-free>. */ | 1484 | * See <design/interface-c/#lock-free>. */ |
| 1554 | 1485 | ||
| 1555 | void mps_ld_merge(mps_ld_t mps_ld, mps_arena_t mps_arena, | 1486 | void mps_ld_merge(mps_ld_t ld, mps_arena_t arena, |
| 1556 | mps_ld_t mps_from) | 1487 | mps_ld_t from) |
| 1557 | { | 1488 | { |
| 1558 | Arena arena = (Arena)mps_arena; | ||
| 1559 | LD ld = (LD)mps_ld; | ||
| 1560 | LD from = (LD)mps_from; | ||
| 1561 | |||
| 1562 | LDMerge(ld, arena, from); | 1489 | LDMerge(ld, arena, from); |
| 1563 | } | 1490 | } |
| 1564 | 1491 | ||
| @@ -1567,11 +1494,9 @@ void mps_ld_merge(mps_ld_t mps_ld, mps_arena_t mps_arena, | |||
| 1567 | * | 1494 | * |
| 1568 | * See <design/interface-c/#lock-free>. */ | 1495 | * See <design/interface-c/#lock-free>. */ |
| 1569 | 1496 | ||
| 1570 | mps_bool_t mps_ld_isstale(mps_ld_t mps_ld, mps_arena_t mps_arena, | 1497 | mps_bool_t mps_ld_isstale(mps_ld_t ld, mps_arena_t arena, |
| 1571 | mps_addr_t addr) | 1498 | mps_addr_t addr) |
| 1572 | { | 1499 | { |
| 1573 | Arena arena = (Arena)mps_arena; | ||
| 1574 | LD ld = (LD)mps_ld; | ||
| 1575 | Bool b; | 1500 | Bool b; |
| 1576 | 1501 | ||
| 1577 | b = LDIsStale(ld, arena, (Addr)addr); | 1502 | b = LDIsStale(ld, arena, (Addr)addr); |
| @@ -1590,20 +1515,18 @@ mps_res_t mps_fix(mps_ss_t mps_ss, mps_addr_t *ref_io) | |||
| 1590 | return res; | 1515 | return res; |
| 1591 | } | 1516 | } |
| 1592 | 1517 | ||
| 1593 | mps_word_t mps_collections(mps_arena_t mps_arena) | 1518 | mps_word_t mps_collections(mps_arena_t arena) |
| 1594 | { | 1519 | { |
| 1595 | Arena arena = (Arena)mps_arena; | ||
| 1596 | return ArenaEpoch(arena); /* thread safe: see <code/arena.h#epoch.ts> */ | 1520 | return ArenaEpoch(arena); /* thread safe: see <code/arena.h#epoch.ts> */ |
| 1597 | } | 1521 | } |
| 1598 | 1522 | ||
| 1599 | 1523 | ||
| 1600 | /* mps_finalize -- register for finalization */ | 1524 | /* mps_finalize -- register for finalization */ |
| 1601 | 1525 | ||
| 1602 | mps_res_t mps_finalize(mps_arena_t mps_arena, mps_addr_t *refref) | 1526 | mps_res_t mps_finalize(mps_arena_t arena, mps_addr_t *refref) |
| 1603 | { | 1527 | { |
| 1604 | Res res; | 1528 | Res res; |
| 1605 | Addr object; | 1529 | Addr object; |
| 1606 | Arena arena = (Arena)mps_arena; | ||
| 1607 | 1530 | ||
| 1608 | ArenaEnter(arena); | 1531 | ArenaEnter(arena); |
| 1609 | 1532 | ||
| @@ -1617,11 +1540,10 @@ mps_res_t mps_finalize(mps_arena_t mps_arena, mps_addr_t *refref) | |||
| 1617 | 1540 | ||
| 1618 | /* mps_definalize -- deregister for finalization */ | 1541 | /* mps_definalize -- deregister for finalization */ |
| 1619 | 1542 | ||
| 1620 | mps_res_t mps_definalize(mps_arena_t mps_arena, mps_addr_t *refref) | 1543 | mps_res_t mps_definalize(mps_arena_t arena, mps_addr_t *refref) |
| 1621 | { | 1544 | { |
| 1622 | Res res; | 1545 | Res res; |
| 1623 | Addr object; | 1546 | Addr object; |
| 1624 | Arena arena = (Arena)mps_arena; | ||
| 1625 | 1547 | ||
| 1626 | ArenaEnter(arena); | 1548 | ArenaEnter(arena); |
| 1627 | 1549 | ||
| @@ -1636,10 +1558,9 @@ mps_res_t mps_definalize(mps_arena_t mps_arena, mps_addr_t *refref) | |||
| 1636 | /* Messages */ | 1558 | /* Messages */ |
| 1637 | 1559 | ||
| 1638 | 1560 | ||
| 1639 | void mps_message_type_enable(mps_arena_t mps_arena, | 1561 | void mps_message_type_enable(mps_arena_t arena, |
| 1640 | mps_message_type_t mps_type) | 1562 | mps_message_type_t mps_type) |
| 1641 | { | 1563 | { |
| 1642 | Arena arena = (Arena)mps_arena; | ||
| 1643 | MessageType type = (MessageType)mps_type; | 1564 | MessageType type = (MessageType)mps_type; |
| 1644 | 1565 | ||
| 1645 | ArenaEnter(arena); | 1566 | ArenaEnter(arena); |
| @@ -1649,10 +1570,9 @@ void mps_message_type_enable(mps_arena_t mps_arena, | |||
| 1649 | ArenaLeave(arena); | 1570 | ArenaLeave(arena); |
| 1650 | } | 1571 | } |
| 1651 | 1572 | ||
| 1652 | void mps_message_type_disable(mps_arena_t mps_arena, | 1573 | void mps_message_type_disable(mps_arena_t arena, |
| 1653 | mps_message_type_t mps_type) | 1574 | mps_message_type_t mps_type) |
| 1654 | { | 1575 | { |
| 1655 | Arena arena = (Arena)mps_arena; | ||
| 1656 | MessageType type = (MessageType)mps_type; | 1576 | MessageType type = (MessageType)mps_type; |
| 1657 | 1577 | ||
| 1658 | ArenaEnter(arena); | 1578 | ArenaEnter(arena); |
| @@ -1662,10 +1582,9 @@ void mps_message_type_disable(mps_arena_t mps_arena, | |||
| 1662 | ArenaLeave(arena); | 1582 | ArenaLeave(arena); |
| 1663 | } | 1583 | } |
| 1664 | 1584 | ||
| 1665 | mps_bool_t mps_message_poll(mps_arena_t mps_arena) | 1585 | mps_bool_t mps_message_poll(mps_arena_t arena) |
| 1666 | { | 1586 | { |
| 1667 | Bool b; | 1587 | Bool b; |
| 1668 | Arena arena = (Arena)mps_arena; | ||
| 1669 | 1588 | ||
| 1670 | ArenaEnter(arena); | 1589 | ArenaEnter(arena); |
| 1671 | 1590 | ||
| @@ -1676,9 +1595,8 @@ mps_bool_t mps_message_poll(mps_arena_t mps_arena) | |||
| 1676 | } | 1595 | } |
| 1677 | 1596 | ||
| 1678 | mps_bool_t mps_message_queue_type(mps_message_type_t *mps_message_type_return, | 1597 | mps_bool_t mps_message_queue_type(mps_message_type_t *mps_message_type_return, |
| 1679 | mps_arena_t mps_arena) | 1598 | mps_arena_t arena) |
| 1680 | { | 1599 | { |
| 1681 | Arena arena = (Arena)mps_arena; | ||
| 1682 | MessageType type; | 1600 | MessageType type; |
| 1683 | Bool b; | 1601 | Bool b; |
| 1684 | 1602 | ||
| @@ -1694,11 +1612,10 @@ mps_bool_t mps_message_queue_type(mps_message_type_t *mps_message_type_return, | |||
| 1694 | } | 1612 | } |
| 1695 | 1613 | ||
| 1696 | mps_bool_t mps_message_get(mps_message_t *mps_message_return, | 1614 | mps_bool_t mps_message_get(mps_message_t *mps_message_return, |
| 1697 | mps_arena_t mps_arena, | 1615 | mps_arena_t arena, |
| 1698 | mps_message_type_t mps_type) | 1616 | mps_message_type_t mps_type) |
| 1699 | { | 1617 | { |
| 1700 | Bool b; | 1618 | Bool b; |
| 1701 | Arena arena = (Arena)mps_arena; | ||
| 1702 | MessageType type = (MessageType)mps_type; | 1619 | MessageType type = (MessageType)mps_type; |
| 1703 | Message message; | 1620 | Message message; |
| 1704 | 1621 | ||
| @@ -1713,10 +1630,9 @@ mps_bool_t mps_message_get(mps_message_t *mps_message_return, | |||
| 1713 | return b; | 1630 | return b; |
| 1714 | } | 1631 | } |
| 1715 | 1632 | ||
| 1716 | void mps_message_discard(mps_arena_t mps_arena, | 1633 | void mps_message_discard(mps_arena_t arena, |
| 1717 | mps_message_t mps_message) | 1634 | mps_message_t mps_message) |
| 1718 | { | 1635 | { |
| 1719 | Arena arena = (Arena)mps_arena; | ||
| 1720 | Message message = (Message)mps_message; | 1636 | Message message = (Message)mps_message; |
| 1721 | 1637 | ||
| 1722 | ArenaEnter(arena); | 1638 | ArenaEnter(arena); |
| @@ -1731,10 +1647,9 @@ void mps_message_discard(mps_arena_t mps_arena, | |||
| 1731 | 1647 | ||
| 1732 | /* -- All Message Types */ | 1648 | /* -- All Message Types */ |
| 1733 | 1649 | ||
| 1734 | mps_message_type_t mps_message_type(mps_arena_t mps_arena, | 1650 | mps_message_type_t mps_message_type(mps_arena_t arena, |
| 1735 | mps_message_t mps_message) | 1651 | mps_message_t mps_message) |
| 1736 | { | 1652 | { |
| 1737 | Arena arena = (Arena)mps_arena; | ||
| 1738 | Message message = (Message)mps_message; | 1653 | Message message = (Message)mps_message; |
| 1739 | MessageType type; | 1654 | MessageType type; |
| 1740 | 1655 | ||
| @@ -1747,10 +1662,9 @@ mps_message_type_t mps_message_type(mps_arena_t mps_arena, | |||
| 1747 | return (mps_message_type_t)type; | 1662 | return (mps_message_type_t)type; |
| 1748 | } | 1663 | } |
| 1749 | 1664 | ||
| 1750 | mps_clock_t mps_message_clock(mps_arena_t mps_arena, | 1665 | mps_clock_t mps_message_clock(mps_arena_t arena, |
| 1751 | mps_message_t mps_message) | 1666 | mps_message_t mps_message) |
| 1752 | { | 1667 | { |
| 1753 | Arena arena = (Arena)mps_arena; | ||
| 1754 | Message message = (Message)mps_message; | 1668 | Message message = (Message)mps_message; |
| 1755 | Clock postedClock; | 1669 | Clock postedClock; |
| 1756 | 1670 | ||
| @@ -1767,10 +1681,9 @@ mps_clock_t mps_message_clock(mps_arena_t mps_arena, | |||
| 1767 | /* -- mps_message_type_finalization */ | 1681 | /* -- mps_message_type_finalization */ |
| 1768 | 1682 | ||
| 1769 | void mps_message_finalization_ref(mps_addr_t *mps_addr_return, | 1683 | void mps_message_finalization_ref(mps_addr_t *mps_addr_return, |
| 1770 | mps_arena_t mps_arena, | 1684 | mps_arena_t arena, |
| 1771 | mps_message_t mps_message) | 1685 | mps_message_t mps_message) |
| 1772 | { | 1686 | { |
| 1773 | Arena arena = (Arena)mps_arena; | ||
| 1774 | Message message = (Message)mps_message; | 1687 | Message message = (Message)mps_message; |
| 1775 | Ref ref; | 1688 | Ref ref; |
| 1776 | 1689 | ||
| @@ -1787,10 +1700,9 @@ void mps_message_finalization_ref(mps_addr_t *mps_addr_return, | |||
| 1787 | 1700 | ||
| 1788 | /* -- mps_message_type_gc */ | 1701 | /* -- mps_message_type_gc */ |
| 1789 | 1702 | ||
| 1790 | size_t mps_message_gc_live_size(mps_arena_t mps_arena, | 1703 | size_t mps_message_gc_live_size(mps_arena_t arena, |
| 1791 | mps_message_t mps_message) | 1704 | mps_message_t mps_message) |
| 1792 | { | 1705 | { |
| 1793 | Arena arena = (Arena)mps_arena; | ||
| 1794 | Message message = (Message)mps_message; | 1706 | Message message = (Message)mps_message; |
| 1795 | Size size; | 1707 | Size size; |
| 1796 | 1708 | ||
| @@ -1803,10 +1715,9 @@ size_t mps_message_gc_live_size(mps_arena_t mps_arena, | |||
| 1803 | return (size_t)size; | 1715 | return (size_t)size; |
| 1804 | } | 1716 | } |
| 1805 | 1717 | ||
| 1806 | size_t mps_message_gc_condemned_size(mps_arena_t mps_arena, | 1718 | size_t mps_message_gc_condemned_size(mps_arena_t arena, |
| 1807 | mps_message_t mps_message) | 1719 | mps_message_t mps_message) |
| 1808 | { | 1720 | { |
| 1809 | Arena arena = (Arena)mps_arena; | ||
| 1810 | Message message = (Message)mps_message; | 1721 | Message message = (Message)mps_message; |
| 1811 | Size size; | 1722 | Size size; |
| 1812 | 1723 | ||
| @@ -1819,10 +1730,9 @@ size_t mps_message_gc_condemned_size(mps_arena_t mps_arena, | |||
| 1819 | return (size_t)size; | 1730 | return (size_t)size; |
| 1820 | } | 1731 | } |
| 1821 | 1732 | ||
| 1822 | size_t mps_message_gc_not_condemned_size(mps_arena_t mps_arena, | 1733 | size_t mps_message_gc_not_condemned_size(mps_arena_t arena, |
| 1823 | mps_message_t mps_message) | 1734 | mps_message_t mps_message) |
| 1824 | { | 1735 | { |
| 1825 | Arena arena = (Arena)mps_arena; | ||
| 1826 | Message message = (Message)mps_message; | 1736 | Message message = (Message)mps_message; |
| 1827 | Size size; | 1737 | Size size; |
| 1828 | 1738 | ||
| @@ -1837,11 +1747,10 @@ size_t mps_message_gc_not_condemned_size(mps_arena_t mps_arena, | |||
| 1837 | 1747 | ||
| 1838 | /* -- mps_message_type_gc_start */ | 1748 | /* -- mps_message_type_gc_start */ |
| 1839 | 1749 | ||
| 1840 | const char *mps_message_gc_start_why(mps_arena_t mps_arena, | 1750 | const char *mps_message_gc_start_why(mps_arena_t arena, |
| 1841 | mps_message_t mps_message) | 1751 | mps_message_t mps_message) |
| 1842 | { | 1752 | { |
| 1843 | const char *s; | 1753 | const char *s; |
| 1844 | Arena arena = (Arena)mps_arena; | ||
| 1845 | Message message = (Message)mps_message; | 1754 | Message message = (Message)mps_message; |
| 1846 | 1755 | ||
| 1847 | ArenaEnter(arena); | 1756 | ArenaEnter(arena); |
| @@ -1858,10 +1767,9 @@ const char *mps_message_gc_start_why(mps_arena_t mps_arena, | |||
| 1858 | 1767 | ||
| 1859 | /* Alert */ | 1768 | /* Alert */ |
| 1860 | 1769 | ||
| 1861 | mps_res_t mps_alert_collection_set(mps_arena_t mps_arena, | 1770 | mps_res_t mps_alert_collection_set(mps_arena_t arena, |
| 1862 | mps_alert_collection_fn_t fn) | 1771 | mps_alert_collection_fn_t fn) |
| 1863 | { | 1772 | { |
| 1864 | Arena arena = (Arena)mps_arena; | ||
| 1865 | ArenaEnter(arena); | 1773 | ArenaEnter(arena); |
| 1866 | arena->alertCollection = fn; | 1774 | arena->alertCollection = fn; |
| 1867 | ArenaLeave(arena); | 1775 | ArenaLeave(arena); |
| @@ -1922,7 +1830,7 @@ mps_res_t mps_ap_alloc_pattern_begin(mps_ap_t mps_ap, | |||
| 1922 | Arena arena; | 1830 | Arena arena; |
| 1923 | 1831 | ||
| 1924 | AVER(mps_ap != NULL); | 1832 | AVER(mps_ap != NULL); |
| 1925 | buf = BufferOfAP((AP)mps_ap); | 1833 | buf = BufferOfAP(mps_ap); |
| 1926 | AVER(TESTT(Buffer, buf)); | 1834 | AVER(TESTT(Buffer, buf)); |
| 1927 | 1835 | ||
| 1928 | arena = BufferArena(buf); | 1836 | arena = BufferArena(buf); |
| @@ -1943,7 +1851,7 @@ mps_res_t mps_ap_alloc_pattern_end(mps_ap_t mps_ap, | |||
| 1943 | Res res; | 1851 | Res res; |
| 1944 | 1852 | ||
| 1945 | AVER(mps_ap != NULL); | 1853 | AVER(mps_ap != NULL); |
| 1946 | buf = BufferOfAP((AP)mps_ap); | 1854 | buf = BufferOfAP(mps_ap); |
| 1947 | AVER(TESTT(Buffer, buf)); | 1855 | AVER(TESTT(Buffer, buf)); |
| 1948 | UNUSED(alloc_pattern); /* .ramp.hack */ | 1856 | UNUSED(alloc_pattern); /* .ramp.hack */ |
| 1949 | 1857 | ||
| @@ -1964,7 +1872,7 @@ mps_res_t mps_ap_alloc_pattern_reset(mps_ap_t mps_ap) | |||
| 1964 | Arena arena; | 1872 | Arena arena; |
| 1965 | 1873 | ||
| 1966 | AVER(mps_ap != NULL); | 1874 | AVER(mps_ap != NULL); |
| 1967 | buf = BufferOfAP((AP)mps_ap); | 1875 | buf = BufferOfAP(mps_ap); |
| 1968 | AVER(TESTT(Buffer, buf)); | 1876 | AVER(TESTT(Buffer, buf)); |
| 1969 | 1877 | ||
| 1970 | arena = BufferArena(buf); | 1878 | arena = BufferArena(buf); |
| @@ -1983,10 +1891,8 @@ mps_res_t mps_ap_alloc_pattern_reset(mps_ap_t mps_ap) | |||
| 1983 | 1891 | ||
| 1984 | /* mps_reservoir_limit_set -- set the reservoir size */ | 1892 | /* mps_reservoir_limit_set -- set the reservoir size */ |
| 1985 | 1893 | ||
| 1986 | void mps_reservoir_limit_set(mps_arena_t mps_arena, size_t size) | 1894 | void mps_reservoir_limit_set(mps_arena_t arena, size_t size) |
| 1987 | { | 1895 | { |
| 1988 | Arena arena = (Arena)mps_arena; | ||
| 1989 | |||
| 1990 | ArenaEnter(arena); | 1896 | ArenaEnter(arena); |
| 1991 | ReservoirSetLimit(ArenaReservoir(arena), size); | 1897 | ReservoirSetLimit(ArenaReservoir(arena), size); |
| 1992 | ArenaLeave(arena); | 1898 | ArenaLeave(arena); |
| @@ -1995,9 +1901,8 @@ void mps_reservoir_limit_set(mps_arena_t mps_arena, size_t size) | |||
| 1995 | 1901 | ||
| 1996 | /* mps_reservoir_limit -- return the reservoir size */ | 1902 | /* mps_reservoir_limit -- return the reservoir size */ |
| 1997 | 1903 | ||
| 1998 | size_t mps_reservoir_limit(mps_arena_t mps_arena) | 1904 | size_t mps_reservoir_limit(mps_arena_t arena) |
| 1999 | { | 1905 | { |
| 2000 | Arena arena = (Arena)mps_arena; | ||
| 2001 | Size size; | 1906 | Size size; |
| 2002 | 1907 | ||
| 2003 | ArenaEnter(arena); | 1908 | ArenaEnter(arena); |
| @@ -2011,9 +1916,8 @@ size_t mps_reservoir_limit(mps_arena_t mps_arena) | |||
| 2011 | 1916 | ||
| 2012 | /* mps_reservoir_available -- return memory available in the reservoir */ | 1917 | /* mps_reservoir_available -- return memory available in the reservoir */ |
| 2013 | 1918 | ||
| 2014 | size_t mps_reservoir_available(mps_arena_t mps_arena) | 1919 | size_t mps_reservoir_available(mps_arena_t arena) |
| 2015 | { | 1920 | { |
| 2016 | Arena arena = (Arena)mps_arena; | ||
| 2017 | Size size; | 1921 | Size size; |
| 2018 | 1922 | ||
| 2019 | ArenaEnter(arena); | 1923 | ArenaEnter(arena); |
| @@ -2030,10 +1934,9 @@ size_t mps_reservoir_available(mps_arena_t mps_arena) | |||
| 2030 | 1934 | ||
| 2031 | /* mps_chain_create -- create a chain */ | 1935 | /* mps_chain_create -- create a chain */ |
| 2032 | 1936 | ||
| 2033 | mps_res_t mps_chain_create(mps_chain_t *chain_o, mps_arena_t mps_arena, | 1937 | mps_res_t mps_chain_create(mps_chain_t *chain_o, mps_arena_t arena, |
| 2034 | size_t gen_count, mps_gen_param_s *params) | 1938 | size_t gen_count, mps_gen_param_s *params) |
| 2035 | { | 1939 | { |
| 2036 | Arena arena = (Arena)mps_arena; | ||
| 2037 | Chain chain; | 1940 | Chain chain; |
| 2038 | Res res; | 1941 | Res res; |
| 2039 | 1942 | ||
diff --git a/mps/code/mpsicv.c b/mps/code/mpsicv.c index 9dd9192097b..0c003442aff 100644 --- a/mps/code/mpsicv.c +++ b/mps/code/mpsicv.c | |||
| @@ -431,19 +431,19 @@ static void *test(void *arg, size_t s) | |||
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | die(mps_root_create_table_masked(&exactRoot, arena, | 433 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 434 | MPS_RANK_EXACT, (mps_rm_t)0, | 434 | mps_rank_exact(), (mps_rm_t)0, |
| 435 | &exactRoots[0], exactRootsCOUNT, | 435 | &exactRoots[0], exactRootsCOUNT, |
| 436 | MPS_WORD_CONST(1)), | 436 | MPS_WORD_CONST(1)), |
| 437 | "root_create_table(exact)"); | 437 | "root_create_table(exact)"); |
| 438 | die(mps_root_create_table(&ambigRoot, arena, | 438 | die(mps_root_create_table(&ambigRoot, arena, |
| 439 | MPS_RANK_AMBIG, (mps_rm_t)0, | 439 | mps_rank_ambig(), (mps_rm_t)0, |
| 440 | &ambigRoots[0], ambigRootsCOUNT), | 440 | &ambigRoots[0], ambigRootsCOUNT), |
| 441 | "root_create_table(ambig)"); | 441 | "root_create_table(ambig)"); |
| 442 | 442 | ||
| 443 | obj = objNULL; | 443 | obj = objNULL; |
| 444 | 444 | ||
| 445 | die(mps_root_create(&singleRoot, arena, | 445 | die(mps_root_create(&singleRoot, arena, |
| 446 | MPS_RANK_EXACT, (mps_rm_t)0, | 446 | mps_rank_exact(), (mps_rm_t)0, |
| 447 | &root_single, &obj, 0), | 447 | &root_single, &obj, 0), |
| 448 | "root_create(single)"); | 448 | "root_create(single)"); |
| 449 | 449 | ||
| @@ -457,7 +457,7 @@ static void *test(void *arg, size_t s) | |||
| 457 | addr_pool_test(arena, alloced_obj, mv, make(), amcpool, format); | 457 | addr_pool_test(arena, alloced_obj, mv, make(), amcpool, format); |
| 458 | 458 | ||
| 459 | die(mps_root_create_fmt(&fmtRoot, arena, | 459 | die(mps_root_create_fmt(&fmtRoot, arena, |
| 460 | MPS_RANK_EXACT, (mps_rm_t)0, | 460 | mps_rank_exact(), (mps_rm_t)0, |
| 461 | dylan_fmt_A()->scan, | 461 | dylan_fmt_A()->scan, |
| 462 | alloced_obj, | 462 | alloced_obj, |
| 463 | (mps_addr_t)(((char*)alloced_obj)+asize)), | 463 | (mps_addr_t)(((char*)alloced_obj)+asize)), |
| @@ -587,7 +587,7 @@ int main(int argc, char **argv) | |||
| 587 | die(mps_thread_reg(&thread, arena), "thread_reg"); | 587 | die(mps_thread_reg(&thread, arena), "thread_reg"); |
| 588 | 588 | ||
| 589 | die(mps_root_create_reg(®_root, arena, | 589 | die(mps_root_create_reg(®_root, arena, |
| 590 | MPS_RANK_AMBIG, (mps_rm_t)0, | 590 | mps_rank_ambig(), (mps_rm_t)0, |
| 591 | thread, &mps_stack_scan_ambig, | 591 | thread, &mps_stack_scan_ambig, |
| 592 | marker, (size_t)0), | 592 | marker, (size_t)0), |
| 593 | "root_create_reg"); | 593 | "root_create_reg"); |
diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c index 02d1ed7a494..d8c80ba0d6a 100644 --- a/mps/code/mv2test.c +++ b/mps/code/mv2test.c | |||
| @@ -220,7 +220,7 @@ static mps_res_t stress(mps_class_t class, mps_arena_t arena, | |||
| 220 | va_end(arg); | 220 | va_end(arg); |
| 221 | if(res != MPS_RES_OK) return res; | 221 | if(res != MPS_RES_OK) return res; |
| 222 | 222 | ||
| 223 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 223 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 224 | 224 | ||
| 225 | /* allocate a load of objects */ | 225 | /* allocate a load of objects */ |
| 226 | for(i=0; i<TEST_SET_SIZE; ++i) { | 226 | for(i=0; i<TEST_SET_SIZE; ++i) { |
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 713a627dd08..c4500a811dd 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c | |||
| @@ -217,7 +217,7 @@ static void AMCSegSketch(Seg seg, char *pbSketch, size_t cbSketch) | |||
| 217 | Bool mut = BufferIsMutator(buffer); | 217 | Bool mut = BufferIsMutator(buffer); |
| 218 | Bool flipped = ((buffer->mode & BufferModeFLIPPED) != 0); | 218 | Bool flipped = ((buffer->mode & BufferModeFLIPPED) != 0); |
| 219 | Bool trapped = BufferIsTrapped(buffer); | 219 | Bool trapped = BufferIsTrapped(buffer); |
| 220 | Bool limitzeroed = (buffer->apStruct.limit == 0); | 220 | Bool limitzeroed = (buffer->ap_s.limit == 0); |
| 221 | 221 | ||
| 222 | pbSketch[3] = 'X'; /* I don't know what's going on! */ | 222 | pbSketch[3] = 'X'; /* I don't know what's going on! */ |
| 223 | 223 | ||
| @@ -1540,10 +1540,10 @@ static Res amcScanNailed(Bool *totalReturn, ScanState ss, Pool pool, | |||
| 1540 | DIAG_SINGLEF(( "amcScanNailed_loop", | 1540 | DIAG_SINGLEF(( "amcScanNailed_loop", |
| 1541 | "scan completed, but had to loop $U times:\n", (WriteFU)loops, | 1541 | "scan completed, but had to loop $U times:\n", (WriteFU)loops, |
| 1542 | " SegSummary: $B\n", (WriteFB)SegSummary(seg), | 1542 | " SegSummary: $B\n", (WriteFB)SegSummary(seg), |
| 1543 | " ss.white: $B\n", (WriteFB)ss->white, | 1543 | " ss.white: $B\n", (WriteFB)ScanStateWhite(ss), |
| 1544 | " ss.unfixedSummary: $B", (WriteFB)ss->unfixedSummary, | 1544 | " ss.unfixedSummary: $B", (WriteFB)ScanStateUnfixedSummary(ss), |
| 1545 | "$S\n", (WriteFS)( | 1545 | "$S\n", (WriteFS)( |
| 1546 | (RefSetSub(ss->unfixedSummary, SegSummary(seg))) | 1546 | (RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))) |
| 1547 | ? "" | 1547 | ? "" |
| 1548 | : " <=== This would have failed .verify.segsummary!" | 1548 | : " <=== This would have failed .verify.segsummary!" |
| 1549 | ), | 1549 | ), |
diff --git a/mps/code/qs.c b/mps/code/qs.c index ae07aea9e60..3d8d730490b 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c | |||
| @@ -338,11 +338,11 @@ static void *go(void *p, size_t s) | |||
| 338 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); | 338 | die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); |
| 339 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), | 339 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), |
| 340 | "AMCCreate"); | 340 | "AMCCreate"); |
| 341 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "APCreate"); | 341 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "APCreate"); |
| 342 | die(mps_root_create_table(®root, arena, MPS_RANK_AMBIG, 0, | 342 | die(mps_root_create_table(®root, arena, mps_rank_ambig(), 0, |
| 343 | (mps_addr_t *)reg, NREGS), | 343 | (mps_addr_t *)reg, NREGS), |
| 344 | "RootCreateTable"); | 344 | "RootCreateTable"); |
| 345 | die(mps_root_create_table(&actroot, arena, MPS_RANK_AMBIG, 0, | 345 | die(mps_root_create_table(&actroot, arena, mps_rank_ambig(), 0, |
| 346 | (mps_addr_t *)&activationStack, sizeof(QSCell)/sizeof(mps_addr_t)), | 346 | (mps_addr_t *)&activationStack, sizeof(QSCell)/sizeof(mps_addr_t)), |
| 347 | "RootCreateTable"); | 347 | "RootCreateTable"); |
| 348 | 348 | ||
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 5a557be9c63..8f7c6095308 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c | |||
| @@ -682,7 +682,7 @@ static void mps_amst_ap_stress(mps_ap_t ap) | |||
| 682 | Buffer buffer; | 682 | Buffer buffer; |
| 683 | Seg seg; | 683 | Seg seg; |
| 684 | 684 | ||
| 685 | buffer = BufferOfAP((AP)ap); | 685 | buffer = BufferOfAP(ap); |
| 686 | AVERT(Buffer, buffer); | 686 | AVERT(Buffer, buffer); |
| 687 | seg = BufferSeg(buffer); | 687 | seg = BufferSeg(buffer); |
| 688 | AMSTStressBufferedSeg(seg, buffer); | 688 | AMSTStressBufferedSeg(seg, buffer); |
| @@ -764,8 +764,8 @@ static void *test(void *arg, size_t s) | |||
| 764 | die(mps_pool_create(&pool, arena, mps_class_amst(), format), | 764 | die(mps_pool_create(&pool, arena, mps_class_amst(), format), |
| 765 | "pool_create(amst)"); | 765 | "pool_create(amst)"); |
| 766 | 766 | ||
| 767 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 767 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 768 | die(mps_ap_create(&busy_ap, pool, MPS_RANK_EXACT), "BufferCreate 2"); | 768 | die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2"); |
| 769 | 769 | ||
| 770 | for(i = 0; i < exactRootsCOUNT; ++i) | 770 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 771 | exactRoots[i] = objNULL; | 771 | exactRoots[i] = objNULL; |
| @@ -773,12 +773,12 @@ static void *test(void *arg, size_t s) | |||
| 773 | ambigRoots[i] = rnd_addr(); | 773 | ambigRoots[i] = rnd_addr(); |
| 774 | 774 | ||
| 775 | die(mps_root_create_table_masked(&exactRoot, arena, | 775 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 776 | MPS_RANK_EXACT, (mps_rm_t)0, | 776 | mps_rank_exact(), (mps_rm_t)0, |
| 777 | &exactRoots[0], exactRootsCOUNT, | 777 | &exactRoots[0], exactRootsCOUNT, |
| 778 | (mps_word_t)1), | 778 | (mps_word_t)1), |
| 779 | "root_create_table(exact)"); | 779 | "root_create_table(exact)"); |
| 780 | die(mps_root_create_table(&ambigRoot, arena, | 780 | die(mps_root_create_table(&ambigRoot, arena, |
| 781 | MPS_RANK_AMBIG, (mps_rm_t)0, | 781 | mps_rank_ambig(), (mps_rm_t)0, |
| 782 | &ambigRoots[0], ambigRootsCOUNT), | 782 | &ambigRoots[0], ambigRootsCOUNT), |
| 783 | "root_create_table(ambig)"); | 783 | "root_create_table(ambig)"); |
| 784 | 784 | ||
diff --git a/mps/code/steptest.c b/mps/code/steptest.c index 7236e9aaa9c..b4f957af79a 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c | |||
| @@ -318,7 +318,7 @@ static void *test(void *arg, size_t s) | |||
| 318 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), | 318 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), |
| 319 | "pool_create(amc)"); | 319 | "pool_create(amc)"); |
| 320 | 320 | ||
| 321 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); | 321 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); |
| 322 | 322 | ||
| 323 | for(i = 0; i < exactRootsCOUNT; ++i) | 323 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 324 | exactRoots[i] = objNULL; | 324 | exactRoots[i] = objNULL; |
| @@ -326,12 +326,12 @@ static void *test(void *arg, size_t s) | |||
| 326 | ambigRoots[i] = rnd_addr(); | 326 | ambigRoots[i] = rnd_addr(); |
| 327 | 327 | ||
| 328 | die(mps_root_create_table_masked(&exactRoot, arena, | 328 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 329 | MPS_RANK_EXACT, (mps_rm_t)0, | 329 | mps_rank_exact(), (mps_rm_t)0, |
| 330 | &exactRoots[0], exactRootsCOUNT, | 330 | &exactRoots[0], exactRootsCOUNT, |
| 331 | (mps_word_t)1), | 331 | (mps_word_t)1), |
| 332 | "root_create_table(exact)"); | 332 | "root_create_table(exact)"); |
| 333 | die(mps_root_create_table(&ambigRoot, arena, | 333 | die(mps_root_create_table(&ambigRoot, arena, |
| 334 | MPS_RANK_AMBIG, (mps_rm_t)0, | 334 | mps_rank_ambig(), (mps_rm_t)0, |
| 335 | &ambigRoots[0], ambigRootsCOUNT), | 335 | &ambigRoots[0], ambigRootsCOUNT), |
| 336 | "root_create_table(ambig)"); | 336 | "root_create_table(ambig)"); |
| 337 | 337 | ||
diff --git a/mps/code/testlib.h b/mps/code/testlib.h index d16f4fb6eef..2bcd50e7c18 100644 --- a/mps/code/testlib.h +++ b/mps/code/testlib.h | |||
| @@ -118,7 +118,7 @@ typedef long longest_t; | |||
| 118 | * argument on stderr and exits the program. Otherwise does nothing. | 118 | * argument on stderr and exits the program. Otherwise does nothing. |
| 119 | * | 119 | * |
| 120 | * Typical use: | 120 | * Typical use: |
| 121 | * die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "APCreate"); | 121 | * die(mps_ap_create(&ap, pool, mps_rank_exact()), "APCreate"); |
| 122 | */ | 122 | */ |
| 123 | 123 | ||
| 124 | extern void die(mps_res_t res, const char *s); | 124 | extern void die(mps_res_t res, const char *s); |
diff --git a/mps/code/trace.c b/mps/code/trace.c index 9771797337d..eb497cd2314 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c | |||
| @@ -40,12 +40,12 @@ Bool ScanStateCheck(ScanState ss) | |||
| 40 | CHECKS(ScanState, ss); | 40 | CHECKS(ScanState, ss); |
| 41 | CHECKL(FUNCHECK(ss->fix)); | 41 | CHECKL(FUNCHECK(ss->fix)); |
| 42 | /* Can't check ss->fixClosure. */ | 42 | /* Can't check ss->fixClosure. */ |
| 43 | CHECKL(ss->zoneShift == ss->arena->zoneShift); | 43 | CHECKL(ScanStateZoneShift(ss) == ss->arena->zoneShift); |
| 44 | white = ZoneSetEMPTY; | 44 | white = ZoneSetEMPTY; |
| 45 | TRACE_SET_ITER(ti, trace, ss->traces, ss->arena) | 45 | TRACE_SET_ITER(ti, trace, ss->traces, ss->arena) |
| 46 | white = ZoneSetUnion(white, ss->arena->trace[ti].white); | 46 | white = ZoneSetUnion(white, ss->arena->trace[ti].white); |
| 47 | TRACE_SET_ITER_END(ti, trace, ss->traces, ss->arena); | 47 | TRACE_SET_ITER_END(ti, trace, ss->traces, ss->arena); |
| 48 | CHECKL(ss->white == white); | 48 | CHECKL(ScanStateWhite(ss) == white); |
| 49 | CHECKU(Arena, ss->arena); | 49 | CHECKU(Arena, ss->arena); |
| 50 | /* Summaries could be anything, and can't be checked. */ | 50 | /* Summaries could be anything, and can't be checked. */ |
| 51 | CHECKL(TraceSetCheck(ss->traces)); | 51 | CHECKL(TraceSetCheck(ss->traces)); |
| @@ -94,12 +94,12 @@ void ScanStateInit(ScanState ss, TraceSet ts, Arena arena, | |||
| 94 | 94 | ||
| 95 | ss->rank = rank; | 95 | ss->rank = rank; |
| 96 | ss->traces = ts; | 96 | ss->traces = ts; |
| 97 | ss->zoneShift = arena->zoneShift; | 97 | ScanStateSetZoneShift(ss, arena->zoneShift); |
| 98 | ss->unfixedSummary = RefSetEMPTY; | 98 | ScanStateSetUnfixedSummary(ss, RefSetEMPTY); |
| 99 | ss->fixedSummary = RefSetEMPTY; | 99 | ss->fixedSummary = RefSetEMPTY; |
| 100 | ss->arena = arena; | 100 | ss->arena = arena; |
| 101 | ss->wasMarked = TRUE; | 101 | ss->wasMarked = TRUE; |
| 102 | ss->white = white; | 102 | ScanStateSetWhite(ss, white); |
| 103 | STATISTIC(ss->fixRefCount = (Count)0); | 103 | STATISTIC(ss->fixRefCount = (Count)0); |
| 104 | STATISTIC(ss->segRefCount = (Count)0); | 104 | STATISTIC(ss->segRefCount = (Count)0); |
| 105 | STATISTIC(ss->whiteSegRefCount = (Count)0); | 105 | STATISTIC(ss->whiteSegRefCount = (Count)0); |
| @@ -1108,7 +1108,7 @@ void ScanStateSetSummary(ScanState ss, RefSet summary) | |||
| 1108 | AVERT(ScanState, ss); | 1108 | AVERT(ScanState, ss); |
| 1109 | /* Can't check summary, as it can be anything. */ | 1109 | /* Can't check summary, as it can be anything. */ |
| 1110 | 1110 | ||
| 1111 | ss->unfixedSummary = RefSetEMPTY; | 1111 | ScanStateSetUnfixedSummary(ss, RefSetEMPTY); |
| 1112 | ss->fixedSummary = summary; | 1112 | ss->fixedSummary = summary; |
| 1113 | AVER(ScanStateSummary(ss) == summary); | 1113 | AVER(ScanStateSummary(ss) == summary); |
| 1114 | } | 1114 | } |
| @@ -1127,7 +1127,8 @@ RefSet ScanStateSummary(ScanState ss) | |||
| 1127 | AVERT(ScanState, ss); | 1127 | AVERT(ScanState, ss); |
| 1128 | 1128 | ||
| 1129 | return RefSetUnion(ss->fixedSummary, | 1129 | return RefSetUnion(ss->fixedSummary, |
| 1130 | RefSetDiff(ss->unfixedSummary, ss->white)); | 1130 | RefSetDiff(ScanStateUnfixedSummary(ss), |
| 1131 | ScanStateWhite(ss))); | ||
| 1131 | } | 1132 | } |
| 1132 | 1133 | ||
| 1133 | 1134 | ||
| @@ -1156,16 +1157,17 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg) | |||
| 1156 | /* Setup result code to return later. */ | 1157 | /* Setup result code to return later. */ |
| 1157 | res = ResOK; | 1158 | res = ResOK; |
| 1158 | } else { /* scan it */ | 1159 | } else { /* scan it */ |
| 1159 | ScanStateStruct ss; | 1160 | ScanStateStruct ssStruct; |
| 1160 | ScanStateInit(&ss, ts, arena, rank, white); | 1161 | ScanState ss = &ssStruct; |
| 1162 | ScanStateInit(ss, ts, arena, rank, white); | ||
| 1161 | 1163 | ||
| 1162 | /* Expose the segment to make sure we can scan it. */ | 1164 | /* Expose the segment to make sure we can scan it. */ |
| 1163 | ShieldExpose(arena, seg); | 1165 | ShieldExpose(arena, seg); |
| 1164 | res = PoolScan(&wasTotal, &ss, SegPool(seg), seg); | 1166 | res = PoolScan(&wasTotal, ss, SegPool(seg), seg); |
| 1165 | /* Cover, regardless of result */ | 1167 | /* Cover, regardless of result */ |
| 1166 | ShieldCover(arena, seg); | 1168 | ShieldCover(arena, seg); |
| 1167 | 1169 | ||
| 1168 | traceSetUpdateCounts(ts, arena, &ss, traceAccountingPhaseSegScan); | 1170 | traceSetUpdateCounts(ts, arena, ss, traceAccountingPhaseSegScan); |
| 1169 | /* Count segments scanned pointlessly */ | 1171 | /* Count segments scanned pointlessly */ |
| 1170 | STATISTIC_STAT | 1172 | STATISTIC_STAT |
| 1171 | ({ | 1173 | ({ |
| @@ -1186,19 +1188,19 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg) | |||
| 1186 | /* .verify.segsummary: were the seg contents, as found by this | 1188 | /* .verify.segsummary: were the seg contents, as found by this |
| 1187 | * scan, consistent with the recorded SegSummary? | 1189 | * scan, consistent with the recorded SegSummary? |
| 1188 | */ | 1190 | */ |
| 1189 | AVER(RefSetSub(ss.unfixedSummary, SegSummary(seg))); | 1191 | AVER(RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))); |
| 1190 | 1192 | ||
| 1191 | if(res != ResOK || !wasTotal) { | 1193 | if(res != ResOK || !wasTotal) { |
| 1192 | /* scan was partial, so... */ | 1194 | /* scan was partial, so... */ |
| 1193 | /* scanned summary should be ORed into segment summary. */ | 1195 | /* scanned summary should be ORed into segment summary. */ |
| 1194 | SegSetSummary(seg, RefSetUnion(SegSummary(seg), ScanStateSummary(&ss))); | 1196 | SegSetSummary(seg, RefSetUnion(SegSummary(seg), ScanStateSummary(ss))); |
| 1195 | } else { | 1197 | } else { |
| 1196 | /* all objects on segment have been scanned, so... */ | 1198 | /* all objects on segment have been scanned, so... */ |
| 1197 | /* scanned summary should replace the segment summary. */ | 1199 | /* scanned summary should replace the segment summary. */ |
| 1198 | SegSetSummary(seg, ScanStateSummary(&ss)); | 1200 | SegSetSummary(seg, ScanStateSummary(ss)); |
| 1199 | } | 1201 | } |
| 1200 | 1202 | ||
| 1201 | ScanStateFinish(&ss); | 1203 | ScanStateFinish(ss); |
| 1202 | } | 1204 | } |
| 1203 | 1205 | ||
| 1204 | if(res == ResOK) { | 1206 | if(res == ResOK) { |
| @@ -1314,7 +1316,7 @@ static Res TraceFix2(ScanState ss, Ref *refIO) | |||
| 1314 | ref = *refIO; | 1316 | ref = *refIO; |
| 1315 | 1317 | ||
| 1316 | /* The zone test should already have been passed by MPS_FIX1 in mps.h. */ | 1318 | /* The zone test should already have been passed by MPS_FIX1 in mps.h. */ |
| 1317 | AVER_CRITICAL(ZoneSetInter(ss->white, | 1319 | AVER_CRITICAL(ZoneSetInter(ScanStateWhite(ss), |
| 1318 | ZoneSetAdd(ss->arena, ZoneSetEMPTY, ref)) != | 1320 | ZoneSetAdd(ss->arena, ZoneSetEMPTY, ref)) != |
| 1319 | ZoneSetEMPTY); | 1321 | ZoneSetEMPTY); |
| 1320 | 1322 | ||
| @@ -1388,7 +1390,7 @@ static Res TraceFix2(ScanState ss, Ref *refIO) | |||
| 1388 | * function is in trace.c and not mpsi.c. | 1390 | * function is in trace.c and not mpsi.c. |
| 1389 | */ | 1391 | */ |
| 1390 | 1392 | ||
| 1391 | mps_res_t mps_fix2(mps_ss_t mps_ss, mps_addr_t *mps_ref_io) | 1393 | mps_res_t _mps_fix2(mps_ss_t mps_ss, mps_addr_t *mps_ref_io) |
| 1392 | { | 1394 | { |
| 1393 | ScanState ss = (ScanState)mps_ss; | 1395 | ScanState ss = (ScanState)mps_ss; |
| 1394 | Ref *refIO = (Ref *)mps_ref_io; | 1396 | Ref *refIO = (Ref *)mps_ref_io; |
diff --git a/mps/code/walkt0.c b/mps/code/walkt0.c index 4b2163d88ee..f4618fd420c 100644 --- a/mps/code/walkt0.c +++ b/mps/code/walkt0.c | |||
| @@ -147,13 +147,13 @@ static void *test(void *arg, size_t s) | |||
| 147 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), | 147 | die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), |
| 148 | "pool_create(amc)"); | 148 | "pool_create(amc)"); |
| 149 | 149 | ||
| 150 | die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "ap_create"); | 150 | die(mps_ap_create(&ap, pool, mps_rank_exact()), "ap_create"); |
| 151 | 151 | ||
| 152 | for(i = 0; i < exactRootsCOUNT; ++i) | 152 | for(i = 0; i < exactRootsCOUNT; ++i) |
| 153 | exactRoots[i] = objNULL; | 153 | exactRoots[i] = objNULL; |
| 154 | 154 | ||
| 155 | die(mps_root_create_table_masked(&exactRoot, arena, | 155 | die(mps_root_create_table_masked(&exactRoot, arena, |
| 156 | MPS_RANK_EXACT, (mps_rm_t)0, | 156 | mps_rank_exact(), (mps_rm_t)0, |
| 157 | &exactRoots[0], exactRootsCOUNT, | 157 | &exactRoots[0], exactRootsCOUNT, |
| 158 | (mps_word_t)1), | 158 | (mps_word_t)1), |
| 159 | "root_create_table(exact)"); | 159 | "root_create_table(exact)"); |
diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 494b443e6b7..be698733a73 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c | |||
| @@ -754,18 +754,18 @@ static void *testscriptB(void *arg, size_t s) | |||
| 754 | for(i = 0; i < myrootAmbigCOUNT; ++i) { | 754 | for(i = 0; i < myrootAmbigCOUNT; ++i) { |
| 755 | myrootAmbig[i] = NULL; | 755 | myrootAmbig[i] = NULL; |
| 756 | } | 756 | } |
| 757 | die(mps_root_create_table(&root_table_Ambig, arena, MPS_RANK_AMBIG, (mps_rm_t)0, | 757 | die(mps_root_create_table(&root_table_Ambig, arena, mps_rank_ambig(), (mps_rm_t)0, |
| 758 | myrootAmbig, (size_t)myrootAmbigCOUNT), | 758 | myrootAmbig, (size_t)myrootAmbigCOUNT), |
| 759 | "root_create - ambig"); | 759 | "root_create - ambig"); |
| 760 | 760 | ||
| 761 | for(i = 0; i < myrootExactCOUNT; ++i) { | 761 | for(i = 0; i < myrootExactCOUNT; ++i) { |
| 762 | myrootExact[i] = NULL; | 762 | myrootExact[i] = NULL; |
| 763 | } | 763 | } |
| 764 | die(mps_root_create_table(&root_table_Exact, arena, MPS_RANK_EXACT, (mps_rm_t)0, | 764 | die(mps_root_create_table(&root_table_Exact, arena, mps_rank_exact(), (mps_rm_t)0, |
| 765 | myrootExact, (size_t)myrootExactCOUNT), | 765 | myrootExact, (size_t)myrootExactCOUNT), |
| 766 | "root_create - exact"); | 766 | "root_create - exact"); |
| 767 | 767 | ||
| 768 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create"); | 768 | die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create"); |
| 769 | 769 | ||
| 770 | /* root_stackreg: stack & registers are ambiguous roots = mutator's workspace */ | 770 | /* root_stackreg: stack & registers are ambiguous roots = mutator's workspace */ |
| 771 | stack_start = &stack_starts_here; | 771 | stack_start = &stack_starts_here; |
diff --git a/mps/code/zmess.c b/mps/code/zmess.c index a1ec5f34466..88f84d2a1af 100644 --- a/mps/code/zmess.c +++ b/mps/code/zmess.c | |||
| @@ -326,10 +326,10 @@ static void *testscriptB(void *arg, size_t s) | |||
| 326 | for(i = 0; i < myrootCOUNT; ++i) { | 326 | for(i = 0; i < myrootCOUNT; ++i) { |
| 327 | myroot[i] = NULL; | 327 | myroot[i] = NULL; |
| 328 | } | 328 | } |
| 329 | die(mps_root_create_table(&root_table, arena, MPS_RANK_EXACT, (mps_rm_t)0, | 329 | die(mps_root_create_table(&root_table, arena, mps_rank_exact(), (mps_rm_t)0, |
| 330 | myroot, (size_t)myrootCOUNT), | 330 | myroot, (size_t)myrootCOUNT), |
| 331 | "root_create"); | 331 | "root_create"); |
| 332 | die(mps_ap_create(&ap, amc, MPS_RANK_EXACT), "ap_create"); | 332 | die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create"); |
| 333 | 333 | ||
| 334 | /* root_stackreg: stack & registers are ambiguous roots = mutator's workspace */ | 334 | /* root_stackreg: stack & registers are ambiguous roots = mutator's workspace */ |
| 335 | die(mps_root_create_reg(&root_stackreg, arena, | 335 | die(mps_root_create_reg(&root_stackreg, arena, |