Title | Walking the roots means you can't walk the formatted objects |
Status | closed |
Priority | optional |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | 1. Create an arena and some roots. 2. Allocate some formatted objects in an automatically managed pool. 3. Park the arena. 4. Call mps_arena_formatted_objects_walk. All objects are visited. 5. Call mps_arena_roots_walk. 6. Call mps_arena_formatted_objects_walk. Not all objects are visited. |
Analysis | mps_arena_roots_walk iterates over all segments in automatically managed pools and calls TraceAddWhite to make the segment white. The purpose of this is to fool the white set test in _mps_fix2 so that the fix method (in this case RootsWalkFix) will be called. However, TraceAddWhite doesn't just add the segment to the white set, it also calls SegWhiten, which potentially has a bunch of side effects. In particular: * amcSegWhiten nails segments with buffers, which causes their formatted objects not to be walked (see job001682). * The Whiten method on the non-moving segment classes (amsSegWhiten, etc.) whitens all the allocated grains in the segment, causing the corresponding objects to be skipped when the Walk method is called. To solve this: 1. In order to fool the white set test in _mps_fix2, it is not necessary for mps_arena_roots_walk to call TraceAddWhite, it can just call SegSetWhite (see gcSegWhiten) and accumulate trace->white. 2. Add a cross-reference between mps_arena_roots_walk and _mps_fix2 so that if the white set test is ever changed then the roots walk logic can be changed to match. 3. Add a smoke test for this case by walking the roots in walkt0.c before walking the formatted objects. 4. Address this comment in walk.c: "ArenaRootsWalk only passes references to GCable pools to the client. NOTE: I'm not sure why this is. RB 2012-07-24" This is because if we had tried to whiten segments in non-GC'able pools then this would have failed in TraceAddWhite → SegWhiten → segNoWhiten. But once we've fixed point 1 above then it will be possible to change this behaviour by whitening all segments. |
How found | manual_test |
Evidence | None |
Created by | Gareth Rees |
Created on | 2018-07-07 21:20:05 |
Last modified by | Gareth Rees |
Last modified on | 2018-07-13 16:41:08 |
History | 2018-07-07 GDR Created. |
Change | Effect | Date | User | Description |
---|---|---|---|---|
194642 | closed | 2018-07-13 16:41:08 | Gareth Rees | Merge branch/2018-07-07/roots-walk into the master sources. |