diff options
| author | Richard Brooksby | 2013-05-16 03:02:20 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2013-05-16 03:02:20 +0100 |
| commit | 93fee75c50ccd7822916cf59d71b9ebfafd6266c (patch) | |
| tree | ebb7220397f8624e6032dca4ca8f79c30cfa4a7f /mps/code | |
| parent | 2ed2ff1893cd27759175481516187a8cd5da6ddb (diff) | |
| download | emacs-93fee75c50ccd7822916cf59d71b9ebfafd6266c.tar.gz emacs-93fee75c50ccd7822916cf59d71b9ebfafd6266c.zip | |
Eliminating unnecessary use of varargs in segment split and merge functions.
Copied from Perforce
Change: 181842
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/mpm.h | 4 | ||||
| -rw-r--r-- | mps/code/mpmtypes.h | 4 | ||||
| -rw-r--r-- | mps/code/poolams.c | 8 | ||||
| -rw-r--r-- | mps/code/seg.c | 32 | ||||
| -rw-r--r-- | mps/code/segsmss.c | 12 |
5 files changed, 26 insertions, 34 deletions
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 93390a3b2bd..5e3984a8b0c 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -651,9 +651,9 @@ extern void SegSetGrey(Seg seg, TraceSet grey); | |||
| 651 | extern void SegSetRankSet(Seg seg, RankSet rankSet); | 651 | extern void SegSetRankSet(Seg seg, RankSet rankSet); |
| 652 | extern void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary); | 652 | extern void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary); |
| 653 | extern Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, | 653 | extern Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, |
| 654 | Bool withReservoirPermit, ...); | 654 | Bool withReservoirPermit); |
| 655 | extern Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, | 655 | extern Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, |
| 656 | Bool withReservoirPermit, ...); | 656 | Bool withReservoirPermit); |
| 657 | extern Res SegDescribe(Seg seg, mps_lib_FILE *stream); | 657 | extern Res SegDescribe(Seg seg, mps_lib_FILE *stream); |
| 658 | extern void SegSetSummary(Seg seg, RefSet summary); | 658 | extern void SegSetSummary(Seg seg, RefSet summary); |
| 659 | extern Buffer SegBuffer(Seg seg); | 659 | extern Buffer SegBuffer(Seg seg); |
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 8dfe310ea70..e9797863bb8 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -160,10 +160,10 @@ typedef void (*SegSetBufferMethod)(Seg seg, Buffer buffer); | |||
| 160 | typedef Res (*SegDescribeMethod)(Seg seg, mps_lib_FILE *stream); | 160 | typedef Res (*SegDescribeMethod)(Seg seg, mps_lib_FILE *stream); |
| 161 | typedef Res (*SegMergeMethod)(Seg seg, Seg segHi, | 161 | typedef Res (*SegMergeMethod)(Seg seg, Seg segHi, |
| 162 | Addr base, Addr mid, Addr limit, | 162 | Addr base, Addr mid, Addr limit, |
| 163 | Bool withReservoirPermit, va_list args); | 163 | Bool withReservoirPermit); |
| 164 | typedef Res (*SegSplitMethod)(Seg seg, Seg segHi, | 164 | typedef Res (*SegSplitMethod)(Seg seg, Seg segHi, |
| 165 | Addr base, Addr mid, Addr limit, | 165 | Addr base, Addr mid, Addr limit, |
| 166 | Bool withReservoirPermit, va_list args); | 166 | Bool withReservoirPermit); |
| 167 | 167 | ||
| 168 | /* Buffer*Method -- see <design/buffer/> */ | 168 | /* Buffer*Method -- see <design/buffer/> */ |
| 169 | 169 | ||
diff --git a/mps/code/poolams.c b/mps/code/poolams.c index da5f917ea73..b871bd98b68 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c | |||
| @@ -318,7 +318,7 @@ static void AMSSegFinish(Seg seg) | |||
| 318 | 318 | ||
| 319 | static Res AMSSegMerge(Seg seg, Seg segHi, | 319 | static Res AMSSegMerge(Seg seg, Seg segHi, |
| 320 | Addr base, Addr mid, Addr limit, | 320 | Addr base, Addr mid, Addr limit, |
| 321 | Bool withReservoirPermit, va_list args) | 321 | Bool withReservoirPermit) |
| 322 | { | 322 | { |
| 323 | SegClass super; | 323 | SegClass super; |
| 324 | Count loGrains, hiGrains, allGrains; | 324 | Count loGrains, hiGrains, allGrains; |
| @@ -357,7 +357,7 @@ static Res AMSSegMerge(Seg seg, Seg segHi, | |||
| 357 | /* Merge the superclass fields via next-method call */ | 357 | /* Merge the superclass fields via next-method call */ |
| 358 | super = SEG_SUPERCLASS(AMSSegClass); | 358 | super = SEG_SUPERCLASS(AMSSegClass); |
| 359 | res = super->merge(seg, segHi, base, mid, limit, | 359 | res = super->merge(seg, segHi, base, mid, limit, |
| 360 | withReservoirPermit, args); | 360 | withReservoirPermit); |
| 361 | if (res != ResOK) | 361 | if (res != ResOK) |
| 362 | goto failSuper; | 362 | goto failSuper; |
| 363 | 363 | ||
| @@ -402,7 +402,7 @@ failCreateTables: | |||
| 402 | 402 | ||
| 403 | static Res AMSSegSplit(Seg seg, Seg segHi, | 403 | static Res AMSSegSplit(Seg seg, Seg segHi, |
| 404 | Addr base, Addr mid, Addr limit, | 404 | Addr base, Addr mid, Addr limit, |
| 405 | Bool withReservoirPermit, va_list args) | 405 | Bool withReservoirPermit) |
| 406 | { | 406 | { |
| 407 | SegClass super; | 407 | SegClass super; |
| 408 | Count loGrains, hiGrains, allGrains; | 408 | Count loGrains, hiGrains, allGrains; |
| @@ -449,7 +449,7 @@ static Res AMSSegSplit(Seg seg, Seg segHi, | |||
| 449 | 449 | ||
| 450 | /* Split the superclass fields via next-method call */ | 450 | /* Split the superclass fields via next-method call */ |
| 451 | super = SEG_SUPERCLASS(AMSSegClass); | 451 | super = SEG_SUPERCLASS(AMSSegClass); |
| 452 | res = super->split(seg, segHi, base, mid, limit, withReservoirPermit, args); | 452 | res = super->split(seg, segHi, base, mid, limit, withReservoirPermit); |
| 453 | if (res != ResOK) | 453 | if (res != ResOK) |
| 454 | goto failSuper; | 454 | goto failSuper; |
| 455 | 455 | ||
diff --git a/mps/code/seg.c b/mps/code/seg.c index f6deeb5ba4f..f1cf1f8501d 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c | |||
| @@ -502,7 +502,7 @@ Bool SegNext(Seg *segReturn, Arena arena, Addr addr) | |||
| 502 | */ | 502 | */ |
| 503 | 503 | ||
| 504 | Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, | 504 | Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, |
| 505 | Bool withReservoirPermit, ...) | 505 | Bool withReservoirPermit) |
| 506 | { | 506 | { |
| 507 | SegClass class; | 507 | SegClass class; |
| 508 | Addr base, mid, limit; | 508 | Addr base, mid, limit; |
| @@ -526,9 +526,8 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, | |||
| 526 | ShieldFlush(arena); /* see <design/seg/#split-merge.shield> */ | 526 | ShieldFlush(arena); /* see <design/seg/#split-merge.shield> */ |
| 527 | 527 | ||
| 528 | /* Invoke class-specific methods to do the merge */ | 528 | /* Invoke class-specific methods to do the merge */ |
| 529 | va_start(args, withReservoirPermit); | ||
| 530 | res = class->merge(segLo, segHi, base, mid, limit, | 529 | res = class->merge(segLo, segHi, base, mid, limit, |
| 531 | withReservoirPermit, args); | 530 | withReservoirPermit); |
| 532 | va_end(args); | 531 | va_end(args); |
| 533 | if (ResOK != res) | 532 | if (ResOK != res) |
| 534 | goto failMerge; | 533 | goto failMerge; |
| @@ -554,14 +553,13 @@ failMerge: | |||
| 554 | */ | 553 | */ |
| 555 | 554 | ||
| 556 | Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, | 555 | Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, |
| 557 | Bool withReservoirPermit, ...) | 556 | Bool withReservoirPermit) |
| 558 | { | 557 | { |
| 559 | Addr base, limit; | 558 | Addr base, limit; |
| 560 | SegClass class; | 559 | SegClass class; |
| 561 | Seg segNew; | 560 | Seg segNew; |
| 562 | Arena arena; | 561 | Arena arena; |
| 563 | Res res; | 562 | Res res; |
| 564 | va_list args; | ||
| 565 | void *p; | 563 | void *p; |
| 566 | 564 | ||
| 567 | AVER(NULL != segLoReturn); | 565 | AVER(NULL != segLoReturn); |
| @@ -586,10 +584,8 @@ Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, | |||
| 586 | segNew = p; | 584 | segNew = p; |
| 587 | 585 | ||
| 588 | /* Invoke class-specific methods to do the split */ | 586 | /* Invoke class-specific methods to do the split */ |
| 589 | va_start(args, withReservoirPermit); | ||
| 590 | res = class->split(seg, segNew, base, at, limit, | 587 | res = class->split(seg, segNew, base, at, limit, |
| 591 | withReservoirPermit, args); | 588 | withReservoirPermit); |
| 592 | va_end(args); | ||
| 593 | if (ResOK != res) | 589 | if (ResOK != res) |
| 594 | goto failSplit; | 590 | goto failSplit; |
| 595 | 591 | ||
| @@ -797,7 +793,7 @@ static void segNoSetBuffer(Seg seg, Buffer buffer) | |||
| 797 | 793 | ||
| 798 | static Res segNoMerge(Seg seg, Seg segHi, | 794 | static Res segNoMerge(Seg seg, Seg segHi, |
| 799 | Addr base, Addr mid, Addr limit, | 795 | Addr base, Addr mid, Addr limit, |
| 800 | Bool withReservoirPermit, va_list args) | 796 | Bool withReservoirPermit) |
| 801 | { | 797 | { |
| 802 | AVERT(Seg, seg); | 798 | AVERT(Seg, seg); |
| 803 | AVERT(Seg, segHi); | 799 | AVERT(Seg, segHi); |
| @@ -806,7 +802,6 @@ static Res segNoMerge(Seg seg, Seg segHi, | |||
| 806 | AVER(SegBase(segHi) == mid); | 802 | AVER(SegBase(segHi) == mid); |
| 807 | AVER(SegLimit(segHi) == limit); | 803 | AVER(SegLimit(segHi) == limit); |
| 808 | AVER(BoolCheck(withReservoirPermit)); | 804 | AVER(BoolCheck(withReservoirPermit)); |
| 809 | UNUSED(args); | ||
| 810 | NOTREACHED; | 805 | NOTREACHED; |
| 811 | return ResFAIL; | 806 | return ResFAIL; |
| 812 | } | 807 | } |
| @@ -820,7 +815,7 @@ static Res segNoMerge(Seg seg, Seg segHi, | |||
| 820 | 815 | ||
| 821 | static Res segTrivMerge(Seg seg, Seg segHi, | 816 | static Res segTrivMerge(Seg seg, Seg segHi, |
| 822 | Addr base, Addr mid, Addr limit, | 817 | Addr base, Addr mid, Addr limit, |
| 823 | Bool withReservoirPermit, va_list args) | 818 | Bool withReservoirPermit) |
| 824 | { | 819 | { |
| 825 | Pool pool; | 820 | Pool pool; |
| 826 | Size align; | 821 | Size align; |
| @@ -843,7 +838,6 @@ static Res segTrivMerge(Seg seg, Seg segHi, | |||
| 843 | AVER(SegBase(segHi) == mid); | 838 | AVER(SegBase(segHi) == mid); |
| 844 | AVER(SegLimit(segHi) == limit); | 839 | AVER(SegLimit(segHi) == limit); |
| 845 | AVER(BoolCheck(withReservoirPermit)); | 840 | AVER(BoolCheck(withReservoirPermit)); |
| 846 | UNUSED(args); | ||
| 847 | 841 | ||
| 848 | /* .similar. */ | 842 | /* .similar. */ |
| 849 | AVER(seg->rankSet == segHi->rankSet); | 843 | AVER(seg->rankSet == segHi->rankSet); |
| @@ -883,7 +877,7 @@ static Res segTrivMerge(Seg seg, Seg segHi, | |||
| 883 | 877 | ||
| 884 | static Res segNoSplit(Seg seg, Seg segHi, | 878 | static Res segNoSplit(Seg seg, Seg segHi, |
| 885 | Addr base, Addr mid, Addr limit, | 879 | Addr base, Addr mid, Addr limit, |
| 886 | Bool withReservoirPermit, va_list args) | 880 | Bool withReservoirPermit) |
| 887 | { | 881 | { |
| 888 | AVERT(Seg, seg); | 882 | AVERT(Seg, seg); |
| 889 | AVER(segHi != NULL); /* can't check fully, it's not initialized */ | 883 | AVER(segHi != NULL); /* can't check fully, it's not initialized */ |
| @@ -892,7 +886,6 @@ static Res segNoSplit(Seg seg, Seg segHi, | |||
| 892 | AVER(SegBase(seg) == base); | 886 | AVER(SegBase(seg) == base); |
| 893 | AVER(SegLimit(seg) == limit); | 887 | AVER(SegLimit(seg) == limit); |
| 894 | AVER(BoolCheck(withReservoirPermit)); | 888 | AVER(BoolCheck(withReservoirPermit)); |
| 895 | UNUSED(args); | ||
| 896 | NOTREACHED; | 889 | NOTREACHED; |
| 897 | return ResFAIL; | 890 | return ResFAIL; |
| 898 | 891 | ||
| @@ -903,7 +896,7 @@ static Res segNoSplit(Seg seg, Seg segHi, | |||
| 903 | 896 | ||
| 904 | static Res segTrivSplit(Seg seg, Seg segHi, | 897 | static Res segTrivSplit(Seg seg, Seg segHi, |
| 905 | Addr base, Addr mid, Addr limit, | 898 | Addr base, Addr mid, Addr limit, |
| 906 | Bool withReservoirPermit, va_list args) | 899 | Bool withReservoirPermit) |
| 907 | { | 900 | { |
| 908 | Tract tract; | 901 | Tract tract; |
| 909 | Pool pool; | 902 | Pool pool; |
| @@ -924,7 +917,6 @@ static Res segTrivSplit(Seg seg, Seg segHi, | |||
| 924 | AVER(SegBase(seg) == base); | 917 | AVER(SegBase(seg) == base); |
| 925 | AVER(SegLimit(seg) == limit); | 918 | AVER(SegLimit(seg) == limit); |
| 926 | AVER(BoolCheck(withReservoirPermit)); | 919 | AVER(BoolCheck(withReservoirPermit)); |
| 927 | UNUSED(args); | ||
| 928 | 920 | ||
| 929 | /* Segment may not be exposed, or in the shield cache */ | 921 | /* Segment may not be exposed, or in the shield cache */ |
| 930 | /* See <design/seg/#split-merge.shield> & <code/shield.c#def.depth> */ | 922 | /* See <design/seg/#split-merge.shield> & <code/shield.c#def.depth> */ |
| @@ -1422,7 +1414,7 @@ static void gcSegSetBuffer(Seg seg, Buffer buffer) | |||
| 1422 | 1414 | ||
| 1423 | static Res gcSegMerge(Seg seg, Seg segHi, | 1415 | static Res gcSegMerge(Seg seg, Seg segHi, |
| 1424 | Addr base, Addr mid, Addr limit, | 1416 | Addr base, Addr mid, Addr limit, |
| 1425 | Bool withReservoirPermit, va_list args) | 1417 | Bool withReservoirPermit) |
| 1426 | { | 1418 | { |
| 1427 | SegClass super; | 1419 | SegClass super; |
| 1428 | GCSeg gcseg, gcsegHi; | 1420 | GCSeg gcseg, gcsegHi; |
| @@ -1453,7 +1445,7 @@ static Res gcSegMerge(Seg seg, Seg segHi, | |||
| 1453 | /* Merge the superclass fields via next-method call */ | 1445 | /* Merge the superclass fields via next-method call */ |
| 1454 | super = SEG_SUPERCLASS(GCSegClass); | 1446 | super = SEG_SUPERCLASS(GCSegClass); |
| 1455 | res = super->merge(seg, segHi, base, mid, limit, | 1447 | res = super->merge(seg, segHi, base, mid, limit, |
| 1456 | withReservoirPermit, args); | 1448 | withReservoirPermit); |
| 1457 | if (res != ResOK) | 1449 | if (res != ResOK) |
| 1458 | goto failSuper; | 1450 | goto failSuper; |
| 1459 | 1451 | ||
| @@ -1492,7 +1484,7 @@ failSuper: | |||
| 1492 | 1484 | ||
| 1493 | static Res gcSegSplit(Seg seg, Seg segHi, | 1485 | static Res gcSegSplit(Seg seg, Seg segHi, |
| 1494 | Addr base, Addr mid, Addr limit, | 1486 | Addr base, Addr mid, Addr limit, |
| 1495 | Bool withReservoirPermit, va_list args) | 1487 | Bool withReservoirPermit) |
| 1496 | { | 1488 | { |
| 1497 | SegClass super; | 1489 | SegClass super; |
| 1498 | GCSeg gcseg, gcsegHi; | 1490 | GCSeg gcseg, gcsegHi; |
| @@ -1525,7 +1517,7 @@ static Res gcSegSplit(Seg seg, Seg segHi, | |||
| 1525 | /* Split the superclass fields via next-method call */ | 1517 | /* Split the superclass fields via next-method call */ |
| 1526 | super = SEG_SUPERCLASS(GCSegClass); | 1518 | super = SEG_SUPERCLASS(GCSegClass); |
| 1527 | res = super->split(seg, segHi, base, mid, limit, | 1519 | res = super->split(seg, segHi, base, mid, limit, |
| 1528 | withReservoirPermit, args); | 1520 | withReservoirPermit); |
| 1529 | if (res != ResOK) | 1521 | if (res != ResOK) |
| 1530 | goto failSuper; | 1522 | goto failSuper; |
| 1531 | 1523 | ||
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 90269aa2abb..5f325a30e8f 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c | |||
| @@ -180,7 +180,7 @@ static void amstSegFinish(Seg seg) | |||
| 180 | */ | 180 | */ |
| 181 | static Res amstSegMerge(Seg seg, Seg segHi, | 181 | static Res amstSegMerge(Seg seg, Seg segHi, |
| 182 | Addr base, Addr mid, Addr limit, | 182 | Addr base, Addr mid, Addr limit, |
| 183 | Bool withReservoirPermit, va_list args) | 183 | Bool withReservoirPermit) |
| 184 | { | 184 | { |
| 185 | SegClass super; | 185 | SegClass super; |
| 186 | AMST amst; | 186 | AMST amst; |
| @@ -198,7 +198,7 @@ static Res amstSegMerge(Seg seg, Seg segHi, | |||
| 198 | /* Merge the superclass fields via direct next-method call */ | 198 | /* Merge the superclass fields via direct next-method call */ |
| 199 | super = SEG_SUPERCLASS(AMSTSegClass); | 199 | super = SEG_SUPERCLASS(AMSTSegClass); |
| 200 | res = super->merge(seg, segHi, base, mid, limit, | 200 | res = super->merge(seg, segHi, base, mid, limit, |
| 201 | withReservoirPermit, args); | 201 | withReservoirPermit); |
| 202 | if (res != ResOK) | 202 | if (res != ResOK) |
| 203 | goto failSuper; | 203 | goto failSuper; |
| 204 | 204 | ||
| @@ -218,7 +218,7 @@ static Res amstSegMerge(Seg seg, Seg segHi, | |||
| 218 | failDeliberate: | 218 | failDeliberate: |
| 219 | /* Call the anti-method (see .fail) */ | 219 | /* Call the anti-method (see .fail) */ |
| 220 | res = super->split(seg, segHi, base, mid, limit, | 220 | res = super->split(seg, segHi, base, mid, limit, |
| 221 | withReservoirPermit, args); | 221 | withReservoirPermit); |
| 222 | AVER(res == ResOK); | 222 | AVER(res == ResOK); |
| 223 | res = ResFAIL; | 223 | res = ResFAIL; |
| 224 | failSuper: | 224 | failSuper: |
| @@ -232,7 +232,7 @@ failSuper: | |||
| 232 | 232 | ||
| 233 | static Res amstSegSplit(Seg seg, Seg segHi, | 233 | static Res amstSegSplit(Seg seg, Seg segHi, |
| 234 | Addr base, Addr mid, Addr limit, | 234 | Addr base, Addr mid, Addr limit, |
| 235 | Bool withReservoirPermit, va_list args) | 235 | Bool withReservoirPermit) |
| 236 | { | 236 | { |
| 237 | SegClass super; | 237 | SegClass super; |
| 238 | AMST amst; | 238 | AMST amst; |
| @@ -249,7 +249,7 @@ static Res amstSegSplit(Seg seg, Seg segHi, | |||
| 249 | /* Split the superclass fields via direct next-method call */ | 249 | /* Split the superclass fields via direct next-method call */ |
| 250 | super = SEG_SUPERCLASS(AMSTSegClass); | 250 | super = SEG_SUPERCLASS(AMSTSegClass); |
| 251 | res = super->split(seg, segHi, base, mid, limit, | 251 | res = super->split(seg, segHi, base, mid, limit, |
| 252 | withReservoirPermit, args); | 252 | withReservoirPermit); |
| 253 | if (res != ResOK) | 253 | if (res != ResOK) |
| 254 | goto failSuper; | 254 | goto failSuper; |
| 255 | 255 | ||
| @@ -273,7 +273,7 @@ static Res amstSegSplit(Seg seg, Seg segHi, | |||
| 273 | failDeliberate: | 273 | failDeliberate: |
| 274 | /* Call the anti-method. (see .fail) */ | 274 | /* Call the anti-method. (see .fail) */ |
| 275 | res = super->merge(seg, segHi, base, mid, limit, | 275 | res = super->merge(seg, segHi, base, mid, limit, |
| 276 | withReservoirPermit, args); | 276 | withReservoirPermit); |
| 277 | AVER(res == ResOK); | 277 | AVER(res == ResOK); |
| 278 | res = ResFAIL; | 278 | res = ResFAIL; |
| 279 | failSuper: | 279 | failSuper: |