aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorGareth Rees2013-05-21 18:39:51 +0100
committerGareth Rees2013-05-21 18:39:51 +0100
commit964fe2954edd2d296b31a6e7ca35c7c1f93aefe3 (patch)
tree376ddefc5b64a60025f3cecc22caa704cf765d1d /mps/code
parent5ea309b5cce16d422982db6075683098a11a0c66 (diff)
downloademacs-964fe2954edd2d296b31a6e7ca35c7c1f93aefe3.tar.gz
emacs-964fe2954edd2d296b31a6e7ca35c7c1f93aefe3.zip
The abq module manages objects internal to the mps (not client objects) so it should use the type void * in its interface, not addr.
Copied from Perforce Change: 182051 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/abq.c14
-rw-r--r--mps/code/abq.h12
-rw-r--r--mps/code/abqtest.c6
-rw-r--r--mps/code/poolmv2.c14
4 files changed, 23 insertions, 23 deletions
diff --git a/mps/code/abq.c b/mps/code/abq.c
index 7393706d5e5..1ba82074c91 100644
--- a/mps/code/abq.c
+++ b/mps/code/abq.c
@@ -19,7 +19,7 @@ SRCID(abq, "$Id$");
19 19
20static Size ABQQueueSize(Count elements, Size elementSize); 20static Size ABQQueueSize(Count elements, Size elementSize);
21static Index ABQNextIndex(ABQ abq, Index index); 21static Index ABQNextIndex(ABQ abq, Index index);
22static Addr ABQElement(ABQ abq, Index index); 22static void *ABQElement(ABQ abq, Index index);
23 23
24 24
25/* Methods */ 25/* Methods */
@@ -97,7 +97,7 @@ void ABQFinish(Arena arena, ABQ abq)
97 97
98 98
99/* ABQPush -- push an element onto the tail of the ABQ */ 99/* ABQPush -- push an element onto the tail of the ABQ */
100Res ABQPush(ABQ abq, Addr element) 100Res ABQPush(ABQ abq, void *element)
101{ 101{
102 AVERT(ABQ, abq); 102 AVERT(ABQ, abq);
103 103
@@ -115,7 +115,7 @@ Res ABQPush(ABQ abq, Addr element)
115 115
116 116
117/* ABQPop -- pop an element from the head of the ABQ */ 117/* ABQPop -- pop an element from the head of the ABQ */
118Res ABQPop(ABQ abq, Addr elementReturn) 118Res ABQPop(ABQ abq, void *elementReturn)
119{ 119{
120 AVER(elementReturn != NULL); 120 AVER(elementReturn != NULL);
121 AVERT(ABQ, abq); 121 AVERT(ABQ, abq);
@@ -135,7 +135,7 @@ Res ABQPop(ABQ abq, Addr elementReturn)
135 135
136 136
137/* ABQPeek -- peek at the head of the ABQ */ 137/* ABQPeek -- peek at the head of the ABQ */
138Res ABQPeek(ABQ abq, Addr elementReturn) 138Res ABQPeek(ABQ abq, void *elementReturn)
139{ 139{
140 AVER(elementReturn != NULL); 140 AVER(elementReturn != NULL);
141 AVERT(ABQ, abq); 141 AVERT(ABQ, abq);
@@ -265,7 +265,7 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP)
265 in = abq->in; 265 in = abq->in;
266 266
267 while (index != in) { 267 while (index != in) {
268 Addr element = ABQElement(abq, index); 268 void *element = ABQElement(abq, index);
269 ABQDisposition disposition = ABQDispositionNONE; 269 ABQDisposition disposition = ABQDispositionNONE;
270 res = (*iterate)(&disposition, element, closureP); 270 res = (*iterate)(&disposition, element, closureP);
271 AVERT(ABQDisposition, disposition); 271 AVERT(ABQDisposition, disposition);
@@ -314,8 +314,8 @@ static Index ABQNextIndex(ABQ abq, Index index)
314 314
315/* ABQElement -- return pointer to the index'th element in the queue 315/* ABQElement -- return pointer to the index'th element in the queue
316 vector. */ 316 vector. */
317static Addr ABQElement(ABQ abq, Index index) { 317static void *ABQElement(ABQ abq, Index index) {
318 return AddrAdd(abq->queue, index * abq->elementSize); 318 return PointerAdd(abq->queue, index * abq->elementSize);
319} 319}
320 320
321 321
diff --git a/mps/code/abq.h b/mps/code/abq.h
index 1e124f87013..b2eb7696923 100644
--- a/mps/code/abq.h
+++ b/mps/code/abq.h
@@ -23,16 +23,16 @@
23/* Prototypes */ 23/* Prototypes */
24 24
25typedef struct ABQStruct *ABQ; 25typedef struct ABQStruct *ABQ;
26typedef Res (*ABQDescribeElement)(Addr element, mps_lib_FILE *stream); 26typedef Res (*ABQDescribeElement)(void *element, mps_lib_FILE *stream);
27typedef unsigned ABQDisposition; 27typedef unsigned ABQDisposition;
28typedef Res (*ABQIterateMethod)(ABQDisposition *dispositionReturn, Addr element, void *closureP); 28typedef Res (*ABQIterateMethod)(ABQDisposition *dispositionReturn, void *element, void *closureP);
29 29
30extern Res ABQInit(Arena arena, ABQ abq, void *owner, Count elements, Size elementSize); 30extern Res ABQInit(Arena arena, ABQ abq, void *owner, Count elements, Size elementSize);
31extern Bool ABQCheck(ABQ abq); 31extern Bool ABQCheck(ABQ abq);
32extern void ABQFinish(Arena arena, ABQ abq); 32extern void ABQFinish(Arena arena, ABQ abq);
33extern Res ABQPush(ABQ abq, Addr element); 33extern Res ABQPush(ABQ abq, void *element);
34extern Res ABQPop(ABQ abq, Addr elementReturn); 34extern Res ABQPop(ABQ abq, void *elementReturn);
35extern Res ABQPeek(ABQ abq, Addr elementReturn); 35extern Res ABQPeek(ABQ abq, void *elementReturn);
36extern Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream); 36extern Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream);
37extern Bool ABQIsEmpty(ABQ abq); 37extern Bool ABQIsEmpty(ABQ abq);
38extern Bool ABQIsFull(ABQ abq); 38extern Bool ABQIsFull(ABQ abq);
@@ -48,7 +48,7 @@ typedef struct ABQStruct
48 Size elementSize; 48 Size elementSize;
49 Index in; 49 Index in;
50 Index out; 50 Index out;
51 Addr queue; 51 void *queue;
52 52
53 /* Meter queue depth at each operation */ 53 /* Meter queue depth at each operation */
54 METER_DECL(push); 54 METER_DECL(push);
diff --git a/mps/code/abqtest.c b/mps/code/abqtest.c
index 3da3bc2f36c..8d35d99c691 100644
--- a/mps/code/abqtest.c
+++ b/mps/code/abqtest.c
@@ -95,7 +95,7 @@ typedef struct TestClosureStruct {
95 Res res; 95 Res res;
96} TestClosureStruct; 96} TestClosureStruct;
97 97
98static Res TestDeleteCallback(ABQDisposition *dispositionReturn, Addr element, 98static Res TestDeleteCallback(ABQDisposition *dispositionReturn, void *element,
99 void *closureP) 99 void *closureP)
100{ 100{
101 TestBlock *a = (TestBlock *)element; 101 TestBlock *a = (TestBlock *)element;
@@ -120,7 +120,7 @@ static void step(void)
120 case 0: case 1: case 2: case 3: 120 case 0: case 1: case 2: case 3:
121 push: 121 push:
122 a = CreateTestBlock(pushee); 122 a = CreateTestBlock(pushee);
123 res = ABQPush(&abq, (Addr)&a); 123 res = ABQPush(&abq, &a);
124 if (res != ResOK) { 124 if (res != ResOK) {
125 goto pop; 125 goto pop;
126 } 126 }
@@ -128,7 +128,7 @@ static void step(void)
128 break; 128 break;
129 case 5: case 6: case 7: case 8: 129 case 5: case 6: case 7: case 8:
130 pop: 130 pop:
131 res = ABQPop(&abq, (Addr)&a); 131 res = ABQPop(&abq, &a);
132 if (res != ResOK){ 132 if (res != ResOK){
133 goto push; 133 goto push;
134 } 134 }
diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c
index dd96b9c3c5f..7333c83f010 100644
--- a/mps/code/poolmv2.c
+++ b/mps/code/poolmv2.c
@@ -494,7 +494,7 @@ static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn,
494 494
495 /* Attempt to retrieve a free block from the ABQ */ 495 /* Attempt to retrieve a free block from the ABQ */
496 ABQRefillIfNecessary(mvt, minSize); 496 ABQRefillIfNecessary(mvt, minSize);
497 res = ABQPeek(MVTABQ(mvt), (Addr)&range); 497 res = ABQPeek(MVTABQ(mvt), &range);
498 if (res != ResOK) { 498 if (res != ResOK) {
499 METER_ACC(mvt->underflows, minSize); 499 METER_ACC(mvt->underflows, minSize);
500 /* <design/poolmvt/#arch.contingency.fragmentation-limit> */ 500 /* <design/poolmvt/#arch.contingency.fragmentation-limit> */
@@ -591,7 +591,7 @@ done:
591 * with it, and the KEEP disposition for ranges that do not. 591 * with it, and the KEEP disposition for ranges that do not.
592 */ 592 */
593static Res MVTDeleteOverlapping(ABQDisposition *dispositionReturn, 593static Res MVTDeleteOverlapping(ABQDisposition *dispositionReturn,
594 Addr element, void *closureP) 594 void *element, void *closureP)
595{ 595{
596 Range oldRange, newRange; 596 Range oldRange, newRange;
597 597
@@ -599,8 +599,8 @@ static Res MVTDeleteOverlapping(ABQDisposition *dispositionReturn,
599 AVER(element != NULL); 599 AVER(element != NULL);
600 AVER(closureP != NULL); 600 AVER(closureP != NULL);
601 601
602 oldRange = (Range)element; 602 oldRange = element;
603 newRange = (Range)closureP; 603 newRange = closureP;
604 604
605 if (RangeOverlap(oldRange, newRange)) { 605 if (RangeOverlap(oldRange, newRange)) {
606 *dispositionReturn = ABQDispositionDELETE; 606 *dispositionReturn = ABQDispositionDELETE;
@@ -622,19 +622,19 @@ static Res MVTReserve(MVT mvt, Range range)
622 AVERT(Range, range); 622 AVERT(Range, range);
623 AVER(RangeSize(range) >= mvt->reuseSize); 623 AVER(RangeSize(range) >= mvt->reuseSize);
624 624
625 res = ABQPush(MVTABQ(mvt), (Addr)range); 625 res = ABQPush(MVTABQ(mvt), range);
626 626
627 /* See <design/poolmvt/#impl.c.free.merge> */ 627 /* See <design/poolmvt/#impl.c.free.merge> */
628 if (res != ResOK) { 628 if (res != ResOK) {
629 Arena arena = PoolArena(MVT2Pool(mvt)); 629 Arena arena = PoolArena(MVT2Pool(mvt));
630 RangeStruct oldRange; 630 RangeStruct oldRange;
631 res = ABQPeek(MVTABQ(mvt), (Addr)&oldRange); 631 res = ABQPeek(MVTABQ(mvt), &oldRange);
632 AVER(res == ResOK); 632 AVER(res == ResOK);
633 AVERT(Range, &oldRange); 633 AVERT(Range, &oldRange);
634 if (!MVTReturnRangeSegs(mvt, &oldRange, arena)) 634 if (!MVTReturnRangeSegs(mvt, &oldRange, arena))
635 goto failOverflow; 635 goto failOverflow;
636 METER_ACC(mvt->returns, RangeSize(&oldRange)); 636 METER_ACC(mvt->returns, RangeSize(&oldRange));
637 res = ABQPush(MVTABQ(mvt), (Addr)range); 637 res = ABQPush(MVTABQ(mvt), range);
638 if (res != ResOK) 638 if (res != ResOK)
639 goto failOverflow; 639 goto failOverflow;
640 } 640 }