diff options
| author | Gareth Rees | 2013-02-08 15:36:50 +0000 |
|---|---|---|
| committer | Gareth Rees | 2013-02-08 15:36:50 +0000 |
| commit | b31cda511d16f6a9947cead9341a1dfff5524cce (patch) | |
| tree | 58974be6b6eced4f9efb5c6045e6873e373afe5e /mps/code | |
| parent | 12b79c27fc769022968a0e0e29f4afd8b5b2e088 (diff) | |
| download | emacs-b31cda511d16f6a9947cead9341a1dfff5524cce.tar.gz emacs-b31cda511d16f6a9947cead9341a1dfff5524cce.zip | |
Undo changes 180370 and 180390 (which supported interior pointers by checking all nails in an object), as these changes are not suitable for release. work around job003359 for the example scheme interpreter by setting the compilation option -fno-inline-functions.
Copied from Perforce
Change: 180941
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/poolamc.c | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 74595875208..71f7f8f6fe6 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c | |||
| @@ -25,7 +25,6 @@ typedef struct amcGenStruct *amcGen; | |||
| 25 | 25 | ||
| 26 | /* forward declarations */ | 26 | /* forward declarations */ |
| 27 | 27 | ||
| 28 | static Bool amcNailGetMark(Seg seg, Ref ref); | ||
| 29 | static Bool amcSegHasNailboard(Seg seg); | 28 | static Bool amcSegHasNailboard(Seg seg); |
| 30 | static Bool AMCCheck(AMC amc); | 29 | static Bool AMCCheck(AMC amc); |
| 31 | static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); | 30 | static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); |
| @@ -301,7 +300,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) | |||
| 301 | if(res != ResOK) | 300 | if(res != ResOK) |
| 302 | return res; | 301 | return res; |
| 303 | 302 | ||
| 304 | res = WriteF(stream, " Map: *===:object @---:nailed bbbb:buffer\n", NULL); | 303 | res = WriteF(stream, " Map: *===:object bbbb:buffer\n", NULL); |
| 305 | if(res != ResOK) | 304 | if(res != ResOK) |
| 306 | return res; | 305 | return res; |
| 307 | 306 | ||
| @@ -318,20 +317,18 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) | |||
| 318 | if(res != ResOK) | 317 | if(res != ResOK) |
| 319 | return res; | 318 | return res; |
| 320 | 319 | ||
| 320 | /* @@@@ This needs to describe nailboards as well */ | ||
| 321 | /* @@@@ This misses a header-sized pad at the end. */ | 321 | /* @@@@ This misses a header-sized pad at the end. */ |
| 322 | for(j = i; j < AddrAdd(i, row); j = AddrAdd(j, step)) { | 322 | for(j = i; j < AddrAdd(i, row); j = AddrAdd(j, step)) { |
| 323 | if(j >= limit) | 323 | if(j >= limit) |
| 324 | c = ' '; /* if seg is not a whole number of print rows */ | 324 | c = ' '; /* if seg is not a whole number of print rows */ |
| 325 | else if(j >= init) | 325 | else if(j >= init) |
| 326 | c = 'b'; | 326 | c = 'b'; |
| 327 | else { | 327 | else if(j == p) { |
| 328 | Bool nailed = amcSegHasNailboard(seg) && amcNailGetMark(seg, j); | 328 | c = '*'; |
| 329 | if(j == p) { | 329 | p = (pool->format->skip)(p); |
| 330 | c = (nailed ? '@' : '*'); | 330 | } else { |
| 331 | p = (pool->format->skip)(p); | 331 | c = '='; |
| 332 | } else { | ||
| 333 | c = (nailed ? '-' : '='); | ||
| 334 | } | ||
| 335 | } | 332 | } |
| 336 | res = WriteF(stream, "$C", c, NULL); | 333 | res = WriteF(stream, "$C", c, NULL); |
| 337 | if(res != ResOK) | 334 | if(res != ResOK) |
| @@ -931,35 +928,6 @@ static Bool amcNailRangeIsMarked(Seg seg, Addr base, Addr limit) | |||
| 931 | } | 928 | } |
| 932 | 929 | ||
| 933 | 930 | ||
| 934 | /* amcNailRangeIsUnmarked -- check that range in the board is unmarked | ||
| 935 | * | ||
| 936 | * Unlike amcNailRangeIsMarked, take arguments as client pointers and | ||
| 937 | * look at the nails for the corresponding base pointers. | ||
| 938 | */ | ||
| 939 | static Bool amcNailRangeIsUnmarked(Seg seg, Addr base, Addr limit) | ||
| 940 | { | ||
| 941 | amcNailboard board; | ||
| 942 | Index ibase, ilimit; | ||
| 943 | Size headerSize; | ||
| 944 | |||
| 945 | headerSize = SegPool(seg)->format->headerSize; | ||
| 946 | base = AddrSub(base, headerSize); | ||
| 947 | limit = AddrSub(limit, headerSize); | ||
| 948 | |||
| 949 | AVER(SegBase(seg) <= base); | ||
| 950 | AVER(base < SegLimit(seg)); | ||
| 951 | AVER(SegBase(seg) <= limit); | ||
| 952 | AVER(limit <= SegLimit(seg)); | ||
| 953 | AVER(base < limit); | ||
| 954 | |||
| 955 | board = amcSegNailboard(seg); | ||
| 956 | AVERT(amcNailboard, board); | ||
| 957 | ibase = AddrOffset(SegBase(seg), base) >> board->markShift; | ||
| 958 | ilimit = AddrOffset(SegBase(seg), limit) >> board->markShift; | ||
| 959 | return BTIsResRange(board->mark, ibase, ilimit); | ||
| 960 | } | ||
| 961 | |||
| 962 | |||
| 963 | /* amcInitComm -- initialize AMC/Z pool | 931 | /* amcInitComm -- initialize AMC/Z pool |
| 964 | * | 932 | * |
| 965 | * See <design/poolamc/#init>. | 933 | * See <design/poolamc/#init>. |
| @@ -1492,7 +1460,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn, | |||
| 1492 | while(p < limit) { | 1460 | while(p < limit) { |
| 1493 | Addr q; | 1461 | Addr q; |
| 1494 | q = (*format->skip)(p); | 1462 | q = (*format->skip)(p); |
| 1495 | if(!amcNailRangeIsUnmarked(seg, p, q)) { | 1463 | if(amcNailGetMark(seg, p)) { |
| 1496 | res = (*format->scan)(&ss->ss_s, p, q); | 1464 | res = (*format->scan)(&ss->ss_s, p, q); |
| 1497 | if(res != ResOK) { | 1465 | if(res != ResOK) { |
| 1498 | *totalReturn = FALSE; | 1466 | *totalReturn = FALSE; |
| @@ -1515,7 +1483,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn, | |||
| 1515 | while(p < limit) { | 1483 | while(p < limit) { |
| 1516 | Addr q; | 1484 | Addr q; |
| 1517 | q = (*format->skip)(p); | 1485 | q = (*format->skip)(p); |
| 1518 | if(!amcNailRangeIsUnmarked(seg, p, q)) { | 1486 | if(amcNailGetMark(seg, p)) { |
| 1519 | res = (*format->scan)(&ss->ss_s, p, q); | 1487 | res = (*format->scan)(&ss->ss_s, p, q); |
| 1520 | if(res != ResOK) { | 1488 | if(res != ResOK) { |
| 1521 | *totalReturn = FALSE; | 1489 | *totalReturn = FALSE; |
| @@ -1695,7 +1663,6 @@ static void amcFixInPlace(Pool pool, Seg seg, ScanState ss, Ref *refIO) | |||
| 1695 | EVENT0(AMCFixInPlace); | 1663 | EVENT0(AMCFixInPlace); |
| 1696 | if(amcSegHasNailboard(seg)) { | 1664 | if(amcSegHasNailboard(seg)) { |
| 1697 | Bool wasMarked = amcNailGetAndSetMark(seg, ref); | 1665 | Bool wasMarked = amcNailGetAndSetMark(seg, ref); |
| 1698 | |||
| 1699 | /* If there are no new marks (i.e., no new traces for which we */ | 1666 | /* If there are no new marks (i.e., no new traces for which we */ |
| 1700 | /* are marking, and no new mark bits set) then we can return */ | 1667 | /* are marking, and no new mark bits set) then we can return */ |
| 1701 | /* immediately, without changing colour. */ | 1668 | /* immediately, without changing colour. */ |
| @@ -1822,11 +1789,9 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1822 | newRef = (*format->isMoved)(ref); /* .exposed.seg */ | 1789 | newRef = (*format->isMoved)(ref); /* .exposed.seg */ |
| 1823 | 1790 | ||
| 1824 | if(newRef == (Addr)0) { | 1791 | if(newRef == (Addr)0) { |
| 1825 | Addr q = (*format->skip)(ref); | 1792 | /* If object is nailed already then we mustn't copy it: */ |
| 1826 | |||
| 1827 | /* If object is nailed already then we mustn't copy it: */ | ||
| 1828 | if(SegNailed(seg) != TraceSetEMPTY | 1793 | if(SegNailed(seg) != TraceSetEMPTY |
| 1829 | && (!amcSegHasNailboard(seg) || !amcNailRangeIsUnmarked(seg, ref, q))) { | 1794 | && (!amcSegHasNailboard(seg) || amcNailGetMark(seg, ref))) { |
| 1830 | /* Segment only needs greying if there are new traces for */ | 1795 | /* Segment only needs greying if there are new traces for */ |
| 1831 | /* which we are nailing. */ | 1796 | /* which we are nailing. */ |
| 1832 | if(!TraceSetSub(ss->traces, SegNailed(seg))) { | 1797 | if(!TraceSetSub(ss->traces, SegNailed(seg))) { |
| @@ -1852,7 +1817,7 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1852 | buffer = gen->forward; | 1817 | buffer = gen->forward; |
| 1853 | AVER_CRITICAL(buffer != NULL); | 1818 | AVER_CRITICAL(buffer != NULL); |
| 1854 | 1819 | ||
| 1855 | length = AddrOffset(ref, q); /* .exposed.seg */ | 1820 | length = AddrOffset(ref, (*format->skip)(ref)); /* .exposed.seg */ |
| 1856 | STATISTIC_STAT(++ss->forwardedCount); | 1821 | STATISTIC_STAT(++ss->forwardedCount); |
| 1857 | ss->forwardedSize += length; | 1822 | ss->forwardedSize += length; |
| 1858 | do { | 1823 | do { |
| @@ -1965,11 +1930,9 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1965 | newRef = (*format->isMoved)(ref); /* .exposed.seg */ | 1930 | newRef = (*format->isMoved)(ref); /* .exposed.seg */ |
| 1966 | 1931 | ||
| 1967 | if(newRef == (Addr)0) { | 1932 | if(newRef == (Addr)0) { |
| 1968 | Addr q = (*format->skip)(ref); | ||
| 1969 | |||
| 1970 | /* If object is nailed already then we mustn't copy it: */ | 1933 | /* If object is nailed already then we mustn't copy it: */ |
| 1971 | if(SegNailed(seg) != TraceSetEMPTY | 1934 | if(SegNailed(seg) != TraceSetEMPTY |
| 1972 | && (!amcSegHasNailboard(seg) || !amcNailRangeIsUnmarked(seg, ref, q))) { | 1935 | && (!amcSegHasNailboard(seg) || amcNailGetMark(seg, ref))) { |
| 1973 | /* Segment only needs greying if there are new traces for */ | 1936 | /* Segment only needs greying if there are new traces for */ |
| 1974 | /* which we are nailing. */ | 1937 | /* which we are nailing. */ |
| 1975 | if(!TraceSetSub(ss->traces, SegNailed(seg))) { | 1938 | if(!TraceSetSub(ss->traces, SegNailed(seg))) { |
| @@ -1995,7 +1958,7 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1995 | buffer = gen->forward; | 1958 | buffer = gen->forward; |
| 1996 | AVER_CRITICAL(buffer != NULL); | 1959 | AVER_CRITICAL(buffer != NULL); |
| 1997 | 1960 | ||
| 1998 | length = AddrOffset(ref, q); /* .exposed.seg */ | 1961 | length = AddrOffset(ref, (*format->skip)(ref)); /* .exposed.seg */ |
| 1999 | STATISTIC_STAT(++ss->forwardedCount); | 1962 | STATISTIC_STAT(++ss->forwardedCount); |
| 2000 | ss->forwardedSize += length; | 1963 | ss->forwardedSize += length; |
| 2001 | do { | 1964 | do { |
| @@ -2084,7 +2047,7 @@ static void amcReclaimNailed(Pool pool, Trace trace, Seg seg) | |||
| 2084 | q = (*format->skip)(p); | 2047 | q = (*format->skip)(p); |
| 2085 | length = AddrOffset(p, q); | 2048 | length = AddrOffset(p, q); |
| 2086 | if(amcSegHasNailboard(seg) | 2049 | if(amcSegHasNailboard(seg) |
| 2087 | ? amcNailRangeIsUnmarked(seg, p, q) | 2050 | ? !amcNailGetMark(seg, p) |
| 2088 | /* If there's no mark table, retain all that hasn't been */ | 2051 | /* If there's no mark table, retain all that hasn't been */ |
| 2089 | /* forwarded. In this case, preservedInPlace* become */ | 2052 | /* forwarded. In this case, preservedInPlace* become */ |
| 2090 | /* somewhat overstated. */ | 2053 | /* somewhat overstated. */ |