1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-23 07:12:12 -07:00
Commit graph

95 commits

Author SHA1 Message Date
Helmut Eller
723f4276b9 * mps/test/function/136.c: Raise limit enough to let the test pass 2026-03-08 18:56:41 +01:00
Helmut Eller
c067ff171e Handle accesses to protected AMC segments while in ephemeron band
* 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.
2026-02-02 17:27:23 +01:00
Helmut Eller
a06d8bd6b9 Add a pool for ephemerons
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.
2026-01-23 08:48:40 +01:00
Bruce Mitchener
2e417719d4 Fix typos. 2024-11-26 22:10:23 +07:00
Gareth Rees
b0a1af5c05 Represent the spare memory as a land. 2022-01-17 20:19:07 +00:00
Gareth Rees
359bd5b034 New api function mps_pool_walk. 2022-01-17 17:39:18 +00:00
Filip Strömbäck
563e21bdef Fixed typos in the test/function/237.c 2021-08-08 12:57:47 +02:00
Filip Strömbäck
1bfb4476e8 Added a test case for github issue
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
2021-03-12 12:40:56 +01:00
Gareth Rees
2e9c91a2bd Remove mps_tramp, deprecated since release 1.111.0. 2020-09-24 09:30:33 +01:00
Gareth Rees
65065bc8c4 Save and restore errno in signal handlers.
Ensure there are assertions on the results of all the libc functions
in protsgix.c and pthrdext.c.
2020-09-02 19:59:23 +01:00
Gareth Rees
d55dc069ab Merge branch 'branch/2020-08-24/eintr' 2020-08-30 09:24:08 +01:00
Gareth Rees
c13b7610d3 Set sa_restart flag when calling sigaction().
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.
2020-08-30 09:23:35 +01:00
Gareth Rees
2172c24889 Use correct function for creating arena.
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).
2020-08-24 17:17:37 +01:00
Gareth Rees
8d5068b5ab Avoid using deprecated function mps_tramp.
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
2019-01-09 16:17:17 +00:00
Gareth Rees
c68dfd2ac4 Use keyword argument interface to avoid underpromotion of arguments.
Copied from Perforce
 Change: 195911
2019-01-08 14:43:41 +00:00
Gareth Rees
cdb8c9bc5e Merge branch/2018-08-01/land-insert-steal into the master sources.
Copied from Perforce
 Change: 194968
2018-08-13 14:42:25 +01:00
Gareth Rees
059f4906eb Need to set the spare commit limit in order for the committed memory to go down.
Copied from Perforce
 Change: 194956
2018-08-13 12:54:03 +01:00
Gareth Rees
5323dedb45 Add some test coverage for mps_key_spare, mps_arena_spare, and mps_arena_spare_set.
Copied from Perforce
 Change: 194945
2018-08-13 10:09:45 +01:00
Gareth Rees
c9c8c03249 Use mps_class_mvff_debug.
Copied from Perforce
 Change: 194866
2018-08-02 14:26:20 +01:00
Gareth Rees
9e5c14a5d1 Replace mv debug with mvff debug.
Remove some remaining occurrences of mpscvm.h.

Copied from Perforce
 Change: 194865
2018-08-02 14:20:23 +01:00
Gareth Rees
3fcea3ce5d New land functions landinsertsteal and landdeletesteal and unit test.
Use LandInsertSteal instead of arenaFreeLandInsertSteal.
Add regression test for job004102.

Copied from Perforce
 Change: 194861
2018-08-02 13:16:15 +01:00
Gareth Rees
c89813834d Replace deprecatd mv with mvff in test cases.
Delete eventrep and replay modules -- these have been broken for a long time. 

Copied from Perforce
 Change: 194843
2018-08-01 13:10:09 +01:00
Gareth Rees
5c8e6891bb Update mmqa tests to cope with the removal of mv:
* 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
2018-07-23 11:05:31 +01:00
Gareth Rees
08ca826368 Ensure that mmqa tests require either a pass or a specified failure.
Copied from Perforce
 Change: 194668
2018-07-16 12:57:42 +01:00
Gareth Rees
b68376aa8c Mmqa tests function/{7,21,22}.c now pass on 32-bit platforms.
MMQA tests function/{8,98}.c now pass on 64-bit platforms.

Copied from Perforce
 Change: 194599
2018-07-11 16:24:47 +01:00
Gareth Rees
9b4f5dfc0e Avoid "warning c4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)" from microsoft visual c.
Copied from Perforce
 Change: 194586
2018-07-11 13:13:17 +01:00
Gareth Rees
cd9e76a6de Check that traces with no condemned objects can be started and finished without error in each automatic pool class. regression test for job004086.
Copied from Perforce
 Change: 194475
2018-07-06 14:26:54 +01:00
Gareth Rees
97f8625195 Fix issues identified in review https://info.ravenbrook.com/mail/2018/07/03/10-10-11/0/
Copied from Perforce
 Change: 194382
2018-07-03 13:04:21 +01:00
Gareth Rees
a8ac974415 Avoid "conversion from 'size_t' to 'unsigned long', possible loss of data" warnings from microsoft visual c.
Copied from Perforce
 Change: 192462
 ServerID: perforce.ravenbrook.com
2016-09-26 16:59:35 +01:00
Gareth Rees
cc0d5a2b25 Avoid parentheses in parameters so that the test case passes on windows.
Copied from Perforce
 Change: 192457
 ServerID: perforce.ravenbrook.com
2016-09-26 16:17:38 +01:00
Gareth Rees
31db2e055c Platform alignment is 16 on w3i6mv, so use mps_pf_align to avoid alignment failure.
Copied from Perforce
 Change: 192456
 ServerID: perforce.ravenbrook.com
2016-09-26 16:13:39 +01:00
Gareth Rees
3398d94ecf Avoid warnings from gcc 4.2 on freebsd.
Copied from Perforce
 Change: 192310
 ServerID: perforce.ravenbrook.com
2016-09-12 14:39:55 +01:00
Gareth Rees
665d8197f0 Use area roots (instead of a thread root) to ensure that objects are finalized reliably even in the hot variety.
Copied from Perforce
 Change: 192235
 ServerID: perforce.ravenbrook.com
2016-09-08 10:57:07 +01:00
Gareth Rees
c2e44cb103 The awl pool contains only weak references to objects that died, so the mps may be able to deduce (via its summary) that it does not need to be condemned, even to collect the world.
Copied from Perforce
 Change: 192226
 ServerID: perforce.ravenbrook.com
2016-09-07 10:20:39 +01:00
Gareth Rees
7e0675d595 Fix mmqa function test cases so that they run on windows. in detail:
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
2016-04-22 15:44:58 +01:00
Gareth Rees
11a5f2bf29 Arenacompact can be called via tracedestroyinit too.
Copied from Perforce
 Change: 190949
 ServerID: perforce.ravenbrook.com
2016-04-11 19:47:52 +01:00
Gareth Rees
7660e38f3e Catch-up merge from master sources to branch/2015-08-11/compact.
Copied from Perforce
 Change: 190901
 ServerID: perforce.ravenbrook.com
2016-04-11 14:40:44 +01:00
Gareth Rees
d0bc388308 Remove mmqa test cases for the reservoir.
Copied from Perforce
 Change: 190018
 ServerID: perforce.ravenbrook.com
2016-03-13 22:44:49 +00:00
Gareth Rees
8a43718971 Avoid unused variable warnings.
Copied from Perforce
 Change: 189978
 ServerID: perforce.ravenbrook.com
2016-03-13 14:58:09 +00:00
Gareth Rees
2bdef084ba Avoid warnings when compiling argerr/{146,147,148}.c with gcc.
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
2016-03-13 14:16:39 +00:00
Gareth Rees
5899074dfb A few more mmqa speedups.
Copied from Perforce
 Change: 189948
 ServerID: perforce.ravenbrook.com
2016-03-13 11:42:53 +00:00
Gareth Rees
37fc360ffe Speed up more mmqa test cases. on my laptop, the whole mmqa test suite (or at least the passing subset) now takes 5 minutes in the hot variety and 11 minutes in the cool variety.
Copied from Perforce
 Change: 189947
 ServerID: perforce.ravenbrook.com
2016-03-13 11:42:32 +00:00
Gareth Rees
f0eb2eb500 Speed up mmqa test cases by reducing iterations. additionally:
* 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
2016-03-12 18:27:38 +00:00
Gareth Rees
aa45b563da Move blatting to a function so that its local variables don't remain on the stack and pin down objects.
Copied from Perforce
 Change: 189714
 ServerID: perforce.ravenbrook.com
2016-03-07 17:31:55 +00:00
Richard Brooksby
43741faecf Catch up merge from master sources.
Copied from Perforce
 Change: 189088
 ServerID: perforce.ravenbrook.com
2016-02-03 16:56:04 +00:00
Richard Brooksby
e64e5b2e25 Backing out the introduction of mps_arena_configure. see <https://info.ravenbrook.com/mail/2016/01/15/11-56-45/0>.
Copied from Perforce
 Change: 189081
 ServerID: perforce.ravenbrook.com
2016-02-03 15:52:05 +00:00
Richard Brooksby
1ac6033058 Catch-up merge from masters.
Copied from Perforce
 Change: 188928
 ServerID: perforce.ravenbrook.com
2016-01-20 11:04:09 +00:00
Richard Brooksby
49ef7fe552 Catch up merge from master sources.
Adding instructions for running tests on OS X.

Copied from Perforce
 Change: 188917
 ServerID: perforce.ravenbrook.com
2016-01-18 15:16:41 +00:00
Gareth Rees
6ea9bc7894 Rename mps_key_arena_commit_limit and mps_key_arena_spare_commit_limit as mps_key_commit_limit and mps_key_spare_commit_limit respectively, as suggested by nb in review.
Copied from Perforce
 Change: 188286
 ServerID: perforce.ravenbrook.com
2015-09-08 16:21:27 +01:00
Gareth Rees
c7a49cf109 New macro arenachunkring encapsulates getting the chunk ring for an arena.
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
2015-08-11 12:03:45 +01:00