* mps/code/trace.c (TraceRankForAccess): While in the ephemeron band,
use RankFINAL for final segments and RankEXACT for the others.
* mps/test/function/eph5.c: New Test.
* mps/test/testsets/passing: Include eph5.c.
* mps/test/test/testlib/ephfmt.h (union header): Use a one-word header.
* mps/test/test/testlib/ephfmt.c: Update accordingly.
* mps/test/function/eph1.c: Update accordingly.
Ephemerons solve the key-in-value problem for weak key/value pairs. It
seems that it's not possible to solve that problem with weak pointers or
finalizers. Basically we want a weak key/value pair that implements the
rule:
The value is reachable, if the key is reachable.
The key-in-value problem occurs if all paths to the key go through the
value. In this situation, the key is considered reachable only if the
value is "externally reachable", i.e. the value is reachable through a
path other than through the weak pair.
Such weak pairs seem to need an extra phase in the GC algorithm. See
[1] for some variants of the algorithm.
https://www.haible.de/bruno/papers/cs/weak/WeakDatastructures-writeup.html
* mps/code/mpmst.h (SegStruct): Add fields propagationNeeded,
marksChanged, and propagationFinished.
* mps/code/mpmtypes.h (RANK_LIST): Add EPHEMERON rank.
* mps/code/mps.s (mps_rank_ephemeron): New prototype.
* mps/code/mpscawl.h (mps_class_aeph, mps_fix_weak_pair)
(mps_fix_weak_or_pair, mps_fix_weak_and_pair): New prototypes.
* mps/code/mpsi.c (mps_rank_ephemeron): New function.
* mps/code/poolawl.c (AEPHSegStruct, AEPHPoolStruct): New. The
implementation the ephemeron pool.
* mps/code/seg.c (segAbsInit): Initialize propagationNeeded,
marksChanged, and propagationFinished.
* mps/code/trace.c (traceBandRetreat, tracePropagateToLowerRanks)
(moveSegToEndOfGreyRing): New helpers.
(TraceRankForAccess): Handle the RankEPHEMERON.
(traceFindGrey, traceScanSegRes): Add special handling for ephemeron
segments.
* mps/test/function/eph1.c: New test file.
* mps/test/function/eph2.c: New test file.
* mps/test/function/eph3.c: New test file.
* mps/test/function/eph4.c: New test file.
* mps/test/test/testlib/ephfmt.c: New file.
* mps/test/test/testlib/ephfmt.h: New file.
* mps/test/test/testlib/manifest: Add ephfmt.c.
* mps/test/testsets/passing: Include eph{1,2,3,4}.c.
This is to illustrate that the value in GetLastError() may be
clobbered by the exception handler on Windows in some
circumstances. As this commit is before the patch, the test currently
fails (clearly showing the issue).
GitHub-reference: https://github.com/Ravenbrook/mps/issues/61
This ensures that if a mutator thread is blocked in a system call when
the MPS handles a signal, the system call will not fail with EINTR but
instead will be restarted.
Add a test case for the thread suspend and resume signals.
Since we are passing a list of keyword arguments, we must call the
keyword-taking function (mps_arena_create_k) and not the deprecated
varargs function (mps_arena_create).
Use mps_root_create_thread in preference to mps_root_create_reg.
New test harness run_test passes pointer to cold end of stack, since this is needed by many tests.
Copied from Perforce
Change: 195917
* Fix typo in argerr/41.c.
* Delete argerr/43.c and argerr/44.c: MVFF doesn't take a maximum size argument so we can't test for erroneous values of this argument.
* Fix assertion condition in conerr/59.c.
* In function/136.c, need to specify extend-by for second pool, now that it's an MVFF pool.
* function/224.c now passes (fragmentation is avoided because MVFF allocations can cross extent boundaries).
Copied from Perforce
Change: 194712
1. On w3i6mv, int and long are 32 bits, so these types can't be used to hold a size_t or an mps_word_t. See 26.c, 38.c, 47.c, 66.c, 123.c, 136.c, 164.c, 165.c, 200.c, 203.c, 204.c, 205.c, 206.c, 207.c, 215.c, 223.c.
2. The Windows command line doesn't cope with parentheses. See 170.c.
3. The natural platform alignment is 16 bytes on w3i6mv, so allocations into pools using the default alignment need to be rounded up. See 21.c, 22.c, 203.c, 204.c, 205.c.
4. Microsoft Visual C/C++ is fussy about signed/unsigned comparison. See 226.c.
5. windows.h defines a SIZE macro so you can't use it as a parameter. See 232.c.
Copied from Perforce
Change: 191569
ServerID: perforce.ravenbrook.com
Test cases conerr/{53,54}.c rely on junk in uninitialized local variables, so ensure that there is some.
Test case function/72.c relies on an object moving, but it might be pinned by an ambiguous reference from the stack, so don't register the stack as a root.
Copied from Perforce
Change: 189964
ServerID: perforce.ravenbrook.com
* Take test options as parameters=.
* Rename BLAH to VERBOSE.
* Clearer reporting of slotHigh, arenaHigh, firstFit options to MVFF.
* Report times in seconds (not centiseconds).
* Reduce the commit limit exponentially and stop when too small.
* Ramp entering/leaving probabilities are scaled by iterations.
Copied from Perforce
Change: 189899
ServerID: perforce.ravenbrook.com
RingLength now returns Count, not Size.
New test case checks that chunks are added and removed from the arena as memory is allocated and freed.
Copied from Perforce
Change: 188133
ServerID: perforce.ravenbrook.com