diff options
| author | David Lovemore | 2012-08-30 13:48:41 +0100 |
|---|---|---|
| committer | David Lovemore | 2012-08-30 13:48:41 +0100 |
| commit | ed8cd9432d6200bbd8e4f833fcd7b18e9f2af18c (patch) | |
| tree | 2bea397e4d75c998b4b7e0db053c387a15d5ae61 /mps/code/trace.c | |
| parent | c986c195abc96dcffc6a33a19b05ef47e154fd83 (diff) | |
| download | emacs-ed8cd9432d6200bbd8e4f833fcd7b18e9f2af18c.tar.gz emacs-ed8cd9432d6200bbd8e4f833fcd7b18e9f2af18c.zip | |
In tracescanareatagged use the alignments of pools in the condemned set to determine mask.
Copied from Perforce
Change: 179117
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code/trace.c')
| -rw-r--r-- | mps/code/trace.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/mps/code/trace.c b/mps/code/trace.c index a12800d4dd9..0f8d84ba3ac 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c | |||
| @@ -138,6 +138,7 @@ Bool TraceCheck(Trace trace) | |||
| 138 | CHECKL(TraceIdCheck(trace->ti)); | 138 | CHECKL(TraceIdCheck(trace->ti)); |
| 139 | CHECKL(trace == &trace->arena->trace[trace->ti]); | 139 | CHECKL(trace == &trace->arena->trace[trace->ti]); |
| 140 | CHECKL(TraceSetIsMember(trace->arena->busyTraces, trace)); | 140 | CHECKL(TraceSetIsMember(trace->arena->busyTraces, trace)); |
| 141 | CHECKL(AlignCheck(trace->whiteMinAlign)); | ||
| 141 | CHECKL(ZoneSetSub(trace->mayMove, trace->white)); | 142 | CHECKL(ZoneSetSub(trace->mayMove, trace->white)); |
| 142 | /* Use trace->state to check more invariants. */ | 143 | /* Use trace->state to check more invariants. */ |
| 143 | switch(trace->state) { | 144 | switch(trace->state) { |
| @@ -367,6 +368,10 @@ Res TraceAddWhite(Trace trace, Seg seg) | |||
| 367 | trace->mayMove = ZoneSetUnion(trace->mayMove, | 368 | trace->mayMove = ZoneSetUnion(trace->mayMove, |
| 368 | ZoneSetOfSeg(trace->arena, seg)); | 369 | ZoneSetOfSeg(trace->arena, seg)); |
| 369 | } | 370 | } |
| 371 | /* This is used to eliminate unaligned references in TraceScanAreaTagged */ | ||
| 372 | if(pool->alignment < trace->whiteMinAlign) { | ||
| 373 | trace->whiteMinAlign = pool->alignment; | ||
| 374 | } | ||
| 370 | } | 375 | } |
| 371 | 376 | ||
| 372 | return ResOK; | 377 | return ResOK; |
| @@ -656,6 +661,7 @@ found: | |||
| 656 | 661 | ||
| 657 | trace->arena = arena; | 662 | trace->arena = arena; |
| 658 | trace->why = why; | 663 | trace->why = why; |
| 664 | trace->whiteMinAlign = (Align)1 << (MPS_WORD_WIDTH - 1); | ||
| 659 | trace->white = ZoneSetEMPTY; | 665 | trace->white = ZoneSetEMPTY; |
| 660 | trace->mayMove = ZoneSetEMPTY; | 666 | trace->mayMove = ZoneSetEMPTY; |
| 661 | trace->ti = ti; | 667 | trace->ti = ti; |
| @@ -1402,13 +1408,37 @@ Res TraceScanArea(ScanState ss, Addr *base, Addr *limit) | |||
| 1402 | 1408 | ||
| 1403 | /* TraceScanAreaTagged -- scan contiguous area of tagged references | 1409 | /* TraceScanAreaTagged -- scan contiguous area of tagged references |
| 1404 | * | 1410 | * |
| 1405 | * This is as TraceScanArea except words are only fixed if they are | 1411 | * This is as TraceScanArea except words are only fixed they are tagged |
| 1406 | * tagged as Dylan references (i.e., bottom two bits are zero). @@@@ | 1412 | * as zero according to the minimum alignment of the condemned set. |
| 1407 | * This Dylan-specificness should be generalized in some way. */ | 1413 | */ |
| 1408 | |||
| 1409 | Res TraceScanAreaTagged(ScanState ss, Addr *base, Addr *limit) | 1414 | Res TraceScanAreaTagged(ScanState ss, Addr *base, Addr *limit) |
| 1410 | { | 1415 | { |
| 1411 | return TraceScanAreaMasked(ss, base, limit, (Word)3); | 1416 | TraceSet ts; |
| 1417 | TraceId ti; | ||
| 1418 | Trace trace; | ||
| 1419 | Arena arena; | ||
| 1420 | Word mask; | ||
| 1421 | |||
| 1422 | AVERT(ScanState, ss); | ||
| 1423 | |||
| 1424 | /* This calculation of the mask could be moved to ScanStateInit | ||
| 1425 | * but there is little point as we probably only do a couple of ambiguous | ||
| 1426 | * scan per thread per flip. */ | ||
| 1427 | /* NOTE: An optimisation that maybe worth considering is setting some of the | ||
| 1428 | * top bits in the mask as an early catch of addresses outside the arena. | ||
| 1429 | * This might help slightly on 64-bit windows. However these are picked up | ||
| 1430 | * soon afterwards by later checks. The bottom bits are more important | ||
| 1431 | * to check as we ignore them in AMCFix, so the non-reference could | ||
| 1432 | * otherwise end up pinning an object. */ | ||
| 1433 | mask = (Word)-1; | ||
| 1434 | ts = ss->traces; | ||
| 1435 | arena = ss->arena; | ||
| 1436 | TRACE_SET_ITER(ti, trace, ts, arena) | ||
| 1437 | AVER(WordIsP2(trace->whiteMinAlign)); | ||
| 1438 | mask = mask & (trace->whiteMinAlign - 1); | ||
| 1439 | TRACE_SET_ITER_END(ti, trace, ts, arena); | ||
| 1440 | |||
| 1441 | return TraceScanAreaMasked(ss, base, limit, mask); | ||
| 1412 | } | 1442 | } |
| 1413 | 1443 | ||
| 1414 | 1444 | ||
| @@ -1423,6 +1453,7 @@ Res TraceScanAreaMasked(ScanState ss, Addr *base, Addr *limit, Word mask) | |||
| 1423 | Addr *p; | 1453 | Addr *p; |
| 1424 | Ref ref; | 1454 | Ref ref; |
| 1425 | 1455 | ||
| 1456 | AVERT(ScanState, ss); | ||
| 1426 | AVER(base != NULL); | 1457 | AVER(base != NULL); |
| 1427 | AVER(limit != NULL); | 1458 | AVER(limit != NULL); |
| 1428 | AVER(base < limit); | 1459 | AVER(base < limit); |