1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 16:51:46 -07:00

Added experimental control over write barrier eagerness.

The write barrier is only raised after three unnecessary scans.

Copied from Perforce
 Change: 186975
 ServerID: perforce.ravenbrook.com
This commit is contained in:
David Lovemore 2014-08-21 15:53:57 +01:00
parent a1d1c3ff6e
commit d2439c4be7
4 changed files with 20 additions and 1 deletions

View file

@ -635,6 +635,12 @@
{ 36 * 1024, 0.45 } /* second gen, after which dynamic */ \
}
/* Experimental Scan Barrier threshold
*
* The number of unecessary scans performed, before raising the write
* barrier to remember the refset summary.
*/
#define TRACE_SCAN_BARRIER_THRESHOLD 3
#endif /* config_h */

View file

@ -300,6 +300,7 @@ typedef struct GCSegStruct { /* GC segment structure */
RingStruct greyRing; /* link in list of grey segs */
RefSet summary; /* summary of references out of seg */
Buffer buffer; /* non-NULL if seg is buffered */
unsigned unnecessaryScans; /* consecutive unnecessary scans performed */
Sig sig; /* <design/sig/> */
} GCSegStruct;

View file

@ -1082,6 +1082,7 @@ static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size,
gcseg->summary = RefSetEMPTY;
gcseg->buffer = NULL;
gcseg->unnecessaryScans = 0;
RingInit(&gcseg->greyRing);
gcseg->sig = GCSegSig;

View file

@ -1105,6 +1105,7 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg)
} else { /* scan it */
ScanStateStruct ssStruct;
ScanState ss = &ssStruct;
Bool considerBarrier = FALSE;
ScanStateInit(ss, ts, arena, rank, white);
/* Expose the segment to make sure we can scan it. */
@ -1135,8 +1136,18 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg)
* scan, consistent with the recorded SegSummary?
*/
AVER(RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg)));
if (ZoneSetInter(ScanStateUnfixedSummary(ss), white) == ZoneSetEMPTY) {
/* a scan was not necessary */
if (((GCSeg)seg)->unnecessaryScans < TRACE_SCAN_BARRIER_THRESHOLD) {
((GCSeg)seg)->unnecessaryScans++;
} else {
considerBarrier = TRUE;
}
} else {
((GCSeg)seg)->unnecessaryScans = 0;
}
if (arena->incremental) {
if (considerBarrier) {
if(res != ResOK || !wasTotal) {
/* scan was partial, so... */
/* scanned summary should be ORed into segment summary. */