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

260 commits

Author SHA1 Message Date
Helmut Eller
5b5fef97ca Minor simplification
* mps/code/trace.c (tracePropagateToLowerRanks): Move the hack from
traceFindGrey to here and simplify it a bit.
* (traceScanSegRes): Remove a debugging assertion that can't fail.
2026-02-22 17:08:20 +01:00
Helmut Eller
43b493ffce Add another workaround for the ephemeron pool
Disabling write barrier deferral in config.h, uncovered a second
problem: mps/test/function/eph1.c fails because segments aren't scanned
if the segment's summary doesn't intersect with the white set.

* mps/code/trace.c (traceFindGrey): Force rescanning by adding the white
set to the segments summary.
2026-02-11 09:53:40 +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
Richard Brooksby
40e6c06da3 Moving transforms design statements out of leader comment of trans.c, updating, clarifying, and cross-referencing, in response to review <https://github.com/ravenbrook/mps/pull/214#issuecomment-1590952221>. 2023-06-16 09:14:14 +01:00
Gareth Rees
359bd5b034 New api function mps_pool_walk. 2022-01-17 17:39:18 +00:00
Gareth Rees
a8fe3c5134 New function scanstateupdatesummary updates seg summary after scan. 2022-01-17 17:12:58 +00:00
Gareth Rees
8b87dccf6e Indirect formatted scanning through the scanstate.
This will allow us to reuse the scanning protocol with an arbitrary area
scanning function (replacing traceFormatScan) in order to implement
formatted object walking without an extra segment method.

Don't insist on scanning only grey segments: we want to be able to
reuse the scan protocol for walking, when the segments are black.
2022-01-17 17:12:58 +00:00
Gareth Rees
7c6c56b541 Ensure that the mps builds with clang 10.
Clang 10 turns on -Wimplicit-int-float-conversion, and on 64-bit
platforms this issues a warning that implicit conversions to double
from Size and unsigned long "may lose precision".

This commit adds casts to (double) for all such conversions. The loss
of precision is either impossible in practice (because a double can
represent all integers up to 2**53, which is about 9 petabytes, well
beyond the addressing capabilities for current CPUs), or else
acceptable, because we are accumulating an approximate quantity like
"collection work" or "fill size" (that has to cope with loss of
precision due in any case), or computing a threshold like the spare
commit limit where it is acceptable for it to be somewhat approximate.
2021-01-10 10:42:05 +00:00
Gareth Rees
aa61fabea2 Remove mps_fix, deprecated since release 1.111.0
Also remove undocumented and deprecated MPS_FIX macro, and rename
TRACE_FIX to TRACE_FIX12 to maintain parallelism.
2020-09-27 14:16:39 +01:00
Gareth Rees
f47c389a52 Fix indentation of second clause of license. 2020-08-30 10:13:06 +01:00
Gareth Rees
af0f431eda Use https: instead of http: when linking to the ravenbrook web site. 2020-08-30 10:13:03 +01:00
Peter Jackson
4de2606846 Publish licence updates in code directory.
Publish minor changes to readme and configure files in main directory.
Main directory and code directory licence texts are now fully updated.

Copied from Perforce
 Change: 196994
2020-06-11 17:05:40 +01:00
Gareth Rees
4eda4e85c7 Use tags with dots; regularize design references from code.
Copied from Perforce
 Change: 195761
2018-11-29 17:12:29 +00:00
Gareth Rees
5faa229dd0 Change http to https for links to {info,www}.ravenbrook.com.
Copied from Perforce
 Change: 195719
2018-11-22 12:34:46 +00:00
Gareth Rees
1ec8c4a141 Improve handling of telemetry events on the critical path:
1. Being on the critical path is a property of the code location where the event is emitted, not of the event type, so indicate this using EVENT_CRITICAL macros rather than a field in the event table.
2. Compile out events on the critical path in hot varieties.
3. Remove TraceFixWhite event (redundant with TraceFixSeg).
4. No need for special handling of PoolFree event -- this are already skipped in hot varieties by dispatching directly to the pool class via PoolFreeMacro.

Copied from Perforce
 Change: 195261
2018-10-15 14:22:16 +01:00
Gareth Rees
cbf9885146 Document the event parameters.
Split event ArenaAccess into ArenaAccessBegin and ArenaAccessEnd to avoid the need for the count field.
New events SegReclaim and SegScan.
Delete some redundant events: AMCFinish (PoolFinish), AMCFix, AMCFixForward, AMCFixInPlace (TraceFix), AMCGenCreate (GenInit), AMCGenDestroy (GenFinish), AMCInit (PoolInitAMC), AMCReclaim (SegReclaim), AMCScanBegin, AMCScanEnd (SegScan), ArenaWriteFaults (ArenaAccessBegin), PoolInitMV, TraceScanSeg (SegScan).
Add result code field to events ArenaAllocFail, CommitLimitSet, SegAllocFail.
Remove arena field from events PoolInitAMS, PoolInitMFS, PoolInitMVFF (already appeared in generic PoolInit event).

Copied from Perforce
 Change: 195247
2018-10-14 14:04:40 +01:00
Gareth Rees
d2d2895c03 Catch-up merge from master sources at changelevel 194022 to branch/2018-06-20/monitor.
Copied from Perforce
 Change: 195071
2018-09-15 21:29:28 +01:00
Gareth Rees
0c8dc0dac5 Address issues found in review <https://info.ravenbrook.com/mail/2018/09/13/15-44-23/0/>
Copied from Perforce
 Change: 195057
2018-09-13 16:47:51 +01:00
Gareth Rees
b170f5af82 Fix compilation error "variable ‘arena’ set but not used" from gcc 4.8.4 in statistic-less varieties.
Copied from Perforce
 Change: 194751
2018-07-28 15:31:15 +01:00
David Lovemore
429bca82ae Fix compile error.
Copied from Perforce
 Change: 194741
2018-07-26 18:51:30 +01:00
Nick Barnes
6b6c6f253a Integrate recent monitor improvements from cet custom monitor branch.
Copied from Perforce
 Change: 194738
2018-07-26 14:40:31 +01:00
Gareth Rees
8ace350062 Merge branch/2016-04-16/trace-gens into the master sources.
Copied from Perforce
 Change: 194685
2018-07-18 18:53:05 +01:00
Gareth Rees
315c0e3a1d Merge branch/2018-07-07/roots-walk into the master sources.
Copied from Perforce
 Change: 194642
2018-07-13 16:41:08 +01:00
Gareth Rees
99260e46d6 Generation's computed mortality has denominator of condemned memory (not new memory), so use the same denominator when predicting the mortality for a trace.
Simpler to compute predicted mortality as casualties/condemned instead of 1 - survivors/condemned.

Copied from Perforce
 Change: 194634
2018-07-13 12:07:54 +01:00
Gareth Rees
032bd714e0 Catch-up merge from master sources at changelevel 194628.
Copied from Perforce
 Change: 194631
2018-07-13 11:28:36 +01:00
Gareth Rees
b1e3bd9932 Improve describe output for generations.
Must take SegBase(seg) before reclaiming the segment in case it gets destroyed.

Copied from Perforce
 Change: 194624
2018-07-12 09:47:29 +01:00
Gareth Rees
21e6672e70 Reclaim the same generations that were condemned.
Copied from Perforce
 Change: 194621
2018-07-12 07:51:04 +01:00
Gareth Rees
c692e2b6e0 Represent the set of generations condemned for a trace.
Eliminate duplication between policyCondemnChain and traceCondemnAll.
Compute better mortality estimate for collection of the world.

Copied from Perforce
 Change: 194611
2018-07-11 21:14:43 +01:00
Gareth Rees
13f5b95ddb Add time series for fraction of generations condemned in chain.
Copied from Perforce
 Change: 194541
2018-07-09 16:56:16 +01:00
Gareth Rees
8d722c4a2b Better position for comment.
Update manual.

Copied from Perforce
 Change: 194511
2018-07-08 08:08:05 +01:00
Gareth Rees
2d7cf3c3d3 In mps_arena_roots_walk, don't call traceaddwhite to whiten a segment, as this calls segwhiten which has undesirable side-effects, including breaking formatting objects walking. instead, call segsetwhite to make the segment white, and set the trace's white summary to the universe.
Add cross-reference from second-stage test in _mps_fix2 so that if the white set test is changed, the roots walking code can be changed to match.
In walkt0, add a smoke test for mps_arena_roots_walk.

Copied from Perforce
 Change: 194507
2018-07-07 22:23:24 +01:00
Gareth Rees
0edb390dc4 Catch-up merge from master sources at changelevel 194456 to branch/2016-03-30/tract-white-elim.
Copied from Perforce
 Change: 194469
2018-07-06 11:06:20 +01:00
Gareth Rees
ba03d79694 Catch-up merge from master sources at changelevel 194449 to branch/2018-06-18/mrgseg.
Copied from Perforce
 Change: 194452
2018-07-05 16:22:24 +01:00
Gareth Rees
cee7c490ac Add time series for mortality in a generation, and size of segments referencing each generation.
Copied from Perforce
 Change: 194348
2018-07-02 15:40:42 +01:00
Gareth Rees
d1d282d351 Restore fixclosure together with explanation.
Copied from Perforce
 Change: 194314
2018-06-29 13:54:55 +01:00
Gareth Rees
01baf3cfda New generic function segflip allows the segment to decide how to handle a trace that’s about to flip.
Copied from Perforce
 Change: 194000
2018-06-20 10:23:16 +01:00
Gareth Rees
8ab47f84d1 Remove unused variable pool.
Copied from Perforce
 Change: 193034
 ServerID: perforce.ravenbrook.com
2017-03-30 09:19:54 +01:00
Gareth Rees
b7a490ae32 Move fix and fixemergency methods from pool class to segment class.
Copied from Perforce
 Change: 193023
 ServerID: perforce.ravenbrook.com
2017-03-30 08:09:14 +01:00
Gareth Rees
9734df3505 Remove unused fixclosure field from trace and scanstate structures.
Copied from Perforce
 Change: 193018
 ServerID: perforce.ravenbrook.com
2017-03-30 07:14:10 +01:00
Gareth Rees
00a4ade456 Move scan method from pool class to segment class.
Copied from Perforce
 Change: 193012
 ServerID: perforce.ravenbrook.com
2017-03-29 19:17:17 +01:00
Gareth Rees
db5db0a9f3 Move reclaim method from pool class to segment class.
Copied from Perforce
 Change: 193007
 ServerID: perforce.ravenbrook.com
2017-03-29 17:13:45 +01:00
Gareth Rees
07adf64ebb Move whiten method from pool class to segment class.
Copied from Perforce
 Change: 193002
 ServerID: perforce.ravenbrook.com
2017-03-29 16:22:14 +01:00
Gareth Rees
47a1715c2d Move greyen method from pool class to segment class.
Copied from Perforce
 Change: 192997
 ServerID: perforce.ravenbrook.com
2017-03-29 15:58:32 +01:00
Gareth Rees
1dc5ac742a Move the blacken method from the pool class to the segment class.
Copied from Perforce
 Change: 192994
 ServerID: perforce.ravenbrook.com
2017-03-29 15:32:17 +01:00
Gareth Rees
587a3efb20 Remove unused pool class methods tracebegin and traceend.
Remove unused event AMCTraceEnd.
The fixEmergency method must have the same type as the fix method because of how they are used.

Copied from Perforce
 Change: 192636
 ServerID: perforce.ravenbrook.com
2016-10-19 14:07:20 +01:00
Gareth Rees
91551170b1 Remove return statements that have no effect.
Copied from Perforce
 Change: 192529
 ServerID: perforce.ravenbrook.com
2016-10-13 15:17:50 +01:00
Gareth Rees
7473718e0a Catch-up merge from master sources to branch/2016-04-13/mortality.
Copied from Perforce
 Change: 192192
 ServerID: perforce.ravenbrook.com
2016-09-05 16:17:04 +01:00
Gareth Rees
331ec20beb Catch-up merge from master sources to branch/2016-04-12/job004000.
Copied from Perforce
 Change: 192187
 ServerID: perforce.ravenbrook.com
2016-09-05 16:01:17 +01:00
Gareth Rees
55adbe705d Fix assertion text in the manual.
Place a cross-reference by each assertion the appears in the manual, to assist in keeping the manual up to date.

Copied from Perforce
 Change: 192097
 ServerID: perforce.ravenbrook.com
2016-09-02 14:11:08 +01:00