diff options
| author | Nick Barnes | 2001-12-19 14:42:33 +0000 |
|---|---|---|
| committer | Nick Barnes | 2001-12-19 14:42:33 +0000 |
| commit | 66348c0196e73ca05cf003a14b91f6c8574afea0 (patch) | |
| tree | 06328e92e1e52c071c1c2eae0bfad02694ef385a /mps/code | |
| parent | db4b3a6fa51ea452f62ed64612da5466d7bc292e (diff) | |
| download | emacs-66348c0196e73ca05cf003a14b91f6c8574afea0.tar.gz emacs-66348c0196e73ca05cf003a14b91f6c8574afea0.zip | |
Make amc obey shield invariants.
Copied from Perforce
Change: 25379
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/poolamc.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index b90d90dbc56..417d5cb455f 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c | |||
| @@ -1397,7 +1397,6 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1397 | RefSet summary; /* summary of object being relocated */ | 1397 | RefSet summary; /* summary of object being relocated */ |
| 1398 | RefSet toSummary; /* summary of object's destination */ | 1398 | RefSet toSummary; /* summary of object's destination */ |
| 1399 | Seg toSeg; /* segment to which object is being relocated */ | 1399 | Seg toSeg; /* segment to which object is being relocated */ |
| 1400 | Bool shieldUp; /* whether we have exposed seg */ | ||
| 1401 | 1400 | ||
| 1402 | /* design.mps.trace.fix.noaver */ | 1401 | /* design.mps.trace.fix.noaver */ |
| 1403 | AVERT_CRITICAL(Pool, pool); | 1402 | AVERT_CRITICAL(Pool, pool); |
| @@ -1441,13 +1440,9 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1441 | AVER_CRITICAL(ref < SegLimit(seg)); | 1440 | AVER_CRITICAL(ref < SegLimit(seg)); |
| 1442 | arena = pool->arena; | 1441 | arena = pool->arena; |
| 1443 | 1442 | ||
| 1444 | /* .access.read: Make sure seg isn't behind a read barrier. */ | 1443 | ShieldExpose(arena, seg); |
| 1445 | shieldUp = FALSE; | ||
| 1446 | if (SegPM(seg) & AccessREAD) { | ||
| 1447 | ShieldExpose(arena, seg); | ||
| 1448 | shieldUp = TRUE; | ||
| 1449 | } | ||
| 1450 | newRef = (*format->isMoved)(ref); | 1444 | newRef = (*format->isMoved)(ref); |
| 1445 | ShieldCover(arena, seg); | ||
| 1451 | 1446 | ||
| 1452 | if (newRef == (Addr)0) { | 1447 | if (newRef == (Addr)0) { |
| 1453 | /* If object is nailed already then we mustn't copy it: */ | 1448 | /* If object is nailed already then we mustn't copy it: */ |
| @@ -1508,12 +1503,9 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1508 | } while (!BUFFER_COMMIT(buffer, newRef, length)); | 1503 | } while (!BUFFER_COMMIT(buffer, newRef, length)); |
| 1509 | ss->copiedSize += length; | 1504 | ss->copiedSize += length; |
| 1510 | 1505 | ||
| 1511 | /* Make sure there's no read or write barrier. */ | 1506 | ShieldExpose(arena, seg); |
| 1512 | if (!shieldUp && (SegPM(seg) & (AccessWRITE | AccessREAD))) { | ||
| 1513 | ShieldExpose(arena, seg); | ||
| 1514 | shieldUp = TRUE; | ||
| 1515 | } | ||
| 1516 | (*format->move)(ref, newRef); | 1507 | (*format->move)(ref, newRef); |
| 1508 | ShieldCover(arena, seg); | ||
| 1517 | } else { | 1509 | } else { |
| 1518 | /* reference to broken heart (which should be snapped out -- */ | 1510 | /* reference to broken heart (which should be snapped out -- */ |
| 1519 | /* consider adding to (non-existant) snap-out cache here) */ | 1511 | /* consider adding to (non-existant) snap-out cache here) */ |
| @@ -1527,8 +1519,6 @@ updateReference: | |||
| 1527 | res = ResOK; | 1519 | res = ResOK; |
| 1528 | 1520 | ||
| 1529 | returnRes: | 1521 | returnRes: |
| 1530 | if (shieldUp) | ||
| 1531 | ShieldCover(arena, seg); | ||
| 1532 | return res; | 1522 | return res; |
| 1533 | } | 1523 | } |
| 1534 | 1524 | ||
| @@ -1554,7 +1544,6 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1554 | RefSet summary; /* summary of object being relocated */ | 1544 | RefSet summary; /* summary of object being relocated */ |
| 1555 | RefSet toSummary; /* summary of object's destination */ | 1545 | RefSet toSummary; /* summary of object's destination */ |
| 1556 | Seg toSeg; /* segment to which object is being relocated */ | 1546 | Seg toSeg; /* segment to which object is being relocated */ |
| 1557 | Bool shieldUp; /* whether we have exposed seg */ | ||
| 1558 | 1547 | ||
| 1559 | /* design.mps.trace.fix.noaver */ | 1548 | /* design.mps.trace.fix.noaver */ |
| 1560 | AVERT_CRITICAL(Pool, pool); | 1549 | AVERT_CRITICAL(Pool, pool); |
| @@ -1597,13 +1586,9 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1597 | AVER_CRITICAL(ref < SegLimit(seg)); /* see .ref-limit */ | 1586 | AVER_CRITICAL(ref < SegLimit(seg)); /* see .ref-limit */ |
| 1598 | arena = pool->arena; | 1587 | arena = pool->arena; |
| 1599 | 1588 | ||
| 1600 | /* .access.read.header: Make sure seg isn't behind a read barrier. */ | 1589 | ShieldExpose(arena, seg); |
| 1601 | shieldUp = FALSE; | ||
| 1602 | if (SegPM(seg) & AccessREAD) { | ||
| 1603 | ShieldExpose(arena, seg); | ||
| 1604 | shieldUp = TRUE; | ||
| 1605 | } | ||
| 1606 | newRef = (*format->isMoved)(ref); | 1590 | newRef = (*format->isMoved)(ref); |
| 1591 | ShieldCover(arena, seg); | ||
| 1607 | 1592 | ||
| 1608 | if (newRef == (Addr)0) { | 1593 | if (newRef == (Addr)0) { |
| 1609 | /* If object is nailed already then we mustn't copy it: */ | 1594 | /* If object is nailed already then we mustn't copy it: */ |
| @@ -1667,12 +1652,9 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) | |||
| 1667 | } while (!BUFFER_COMMIT(buffer, newBase, length)); | 1652 | } while (!BUFFER_COMMIT(buffer, newBase, length)); |
| 1668 | ss->copiedSize += length; | 1653 | ss->copiedSize += length; |
| 1669 | 1654 | ||
| 1670 | /* Make sure there's no read or write barrier. */ | 1655 | ShieldExpose(arena, seg); |
| 1671 | if (!shieldUp && (SegPM(seg) & (AccessWRITE | AccessREAD))) { | ||
| 1672 | ShieldExpose(arena, seg); | ||
| 1673 | shieldUp = TRUE; | ||
| 1674 | } | ||
| 1675 | (*format->move)(ref, newRef); | 1656 | (*format->move)(ref, newRef); |
| 1657 | ShieldCover(arena, seg); | ||
| 1676 | } else { | 1658 | } else { |
| 1677 | /* reference to broken heart (which should be snapped out -- */ | 1659 | /* reference to broken heart (which should be snapped out -- */ |
| 1678 | /* consider adding to (non-existent) snap-out cache here) */ | 1660 | /* consider adding to (non-existent) snap-out cache here) */ |
| @@ -1686,8 +1668,6 @@ updateReference: | |||
| 1686 | res = ResOK; | 1668 | res = ResOK; |
| 1687 | 1669 | ||
| 1688 | returnRes: | 1670 | returnRes: |
| 1689 | if (shieldUp) | ||
| 1690 | ShieldCover(arena, seg); | ||
| 1691 | return res; | 1671 | return res; |
| 1692 | } | 1672 | } |
| 1693 | 1673 | ||
| @@ -1967,7 +1947,7 @@ DEFINE_POOL_CLASS(AMCZPoolClass, this) | |||
| 1967 | this->grey = PoolNoGrey; | 1947 | this->grey = PoolNoGrey; |
| 1968 | this->scan = PoolNoScan; | 1948 | this->scan = PoolNoScan; |
| 1969 | } | 1949 | } |
| 1970 | 1950 | ||
| 1971 | 1951 | ||
| 1972 | /* mps_class_amc -- return the pool class descriptor to the client */ | 1952 | /* mps_class_amc -- return the pool class descriptor to the client */ |
| 1973 | 1953 | ||