diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 824bb634340..d626969c19c 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h @@ -1,7 +1,7 @@ /* mpmst.h: MEMORY POOL MANAGER DATA STRUCTURES * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2001 Global Graphics Software. * * .design: This header file crosses module boundaries. The relevant @@ -398,6 +398,11 @@ typedef struct mps_fmt_s { * through the MPS interface to optimise the critical path scan loop. * See ["The critical path through the MPS"](../design/critical-path.txt). * + * .ss.fix-closure: The fixClosure member allows the caller of the + * scanning protocol to pass data through to this fix function. This + * is not used in the public MPS, but is needed by the transforms + * extension. + * * .ss.zone: For binary compatibility, the zone shift is exported as * a word rather than a shift, so that the external mps_ss_s is a uniform * three-word structure. See and . @@ -419,6 +424,7 @@ typedef struct ScanStateStruct { struct mps_ss_s ss_s; /* .ss */ Arena arena; /* owning arena */ SegFixMethod fix; /* third stage fix function */ + void *fixClosure; /* see .ss.fix-closure */ TraceSet traces; /* traces to scan for */ Rank rank; /* reference rank of scanning */ Bool wasMarked; /* design.mps.fix.protocol.was-ready */ @@ -450,6 +456,7 @@ typedef struct TraceStruct { Rank band; /* current band */ Bool firstStretch; /* in first stretch of band (see accessor) */ SegFixMethod fix; /* fix method to apply to references */ + void *fixClosure; /* see .ss.fix-closure */ Chain chain; /* chain being incrementally collected */ STATISTIC_DECL(Size preTraceArenaReserved) /* ArenaReserved before this trace */ Size condemned; /* condemned bytes */ @@ -817,7 +824,7 @@ typedef struct AllocPatternStruct { /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/trace.c b/mps/code/trace.c index 4c58b37b43b..44046041efb 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1,7 +1,7 @@ /* trace.c: GENERIC TRACER IMPLEMENTATION * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. + * Copyright (c) 2001-2018 Ravenbrook Limited. * See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * @@ -38,6 +38,7 @@ Bool ScanStateCheck(ScanState ss) CHECKS(ScanState, ss); CHECKL(FUNCHECK(ss->fix)); + /* Can't check ss->fixClosure. */ CHECKL(ScanStateZoneShift(ss) == ss->arena->zoneShift); white = ZoneSetEMPTY; TRACE_SET_ITER(ti, trace, ss->traces, ss->arena) @@ -73,11 +74,14 @@ void ScanStateInit(ScanState ss, TraceSet ts, Arena arena, necessary to dispatch to the fix methods of sets of traces in TraceFix. */ ss->fix = NULL; + ss->fixClosure = NULL; TRACE_SET_ITER(ti, trace, ts, arena) { if (ss->fix == NULL) { ss->fix = trace->fix; + ss->fixClosure = trace->fixClosure; } else { AVER(ss->fix == trace->fix); + AVER(ss->fixClosure == trace->fixClosure); } } TRACE_SET_ITER_END(ti, trace, ts, arena); AVER(ss->fix != NULL); @@ -188,6 +192,7 @@ Bool TraceCheck(Trace trace) CHECKU(Chain, trace->chain); } CHECKL(FUNCHECK(trace->fix)); + /* Can't check trace->fixClosure. */ /* @@@@ checks for counts missing */ @@ -669,6 +674,7 @@ found: trace->state = TraceINIT; trace->band = RankMIN; trace->fix = SegFix; + trace->fixClosure = NULL; trace->chain = NULL; STATISTIC(trace->preTraceArenaReserved = ArenaReserved(arena)); trace->condemned = (Size)0; /* nothing condemned yet */ @@ -1860,7 +1866,7 @@ Res TraceDescribe(Trace trace, mps_lib_FILE *stream, Count depth) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited + * Copyright (C) 2001-2018 Ravenbrook Limited * . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options.