|
From: | Peter Bex |
Subject: | [PATCH] A few simplifications/maintainability improvements of the GC |
Date: | Sun, 19 Apr 2020 08:47:20 +0200 |
User-agent: | Mutt/1.10.1 (2018-07-13) |
Hi all, After the recent patches to the GC, I was looking over that code again and decided it would be quite easy to make that code a lot more readable and maintainable, with less if statements and getting rid of a few gotos, as well. I haven't yet managed to get rid of i_like_spaghetti, though :) Attached are a bunch of patches which incrementally simplify the GC. I realised that the basic functionality of the three GC modes (minor, major and realloc) are mostly the same: - Mark live objects from saved stack and mutation stack - Mark live heap objects (not in minor mode) - Run Cheney's algorithm to mark nested objects There's some other stuff that actually differs per mode (like finalizers and locatives), but that's stuff that can stay the same. The marking of live objects and then nested objects is copy/pasted three times: There's an if inside really_mark to distinguish between major/minor mode and then there's of course really_remark. But the copying is exactly the same! The only thing that differs are the addresses that we use to copy to, and the forwarding pointer handling. So, these patches change really_mark to accept the three heap pointers (start, top and limit) as arguments, then pass in the corresponding pointers to [C_]fromspace{start,top,limit}, tospace{start,top,limit} or new_tospace_{start,top,limit}, depending on the mode we're in. This is done by patches 1 and 2. Patch 3 is a trivial change to drop a few unused functions. Patch 4 moves the marking of live objects into a separate function. Patch 5 moves marking of nested objects into a separate function. Finally, patch 6 is simply something to fix an annoyance during development of this: Emacs insists on indenting, so fixing the basic offset in .dir-locals.el. I know it's a lot of patches, and they're somewhat largish, but it's mostly just moving code around. I didn't really make any fundamental changes to the code. This work is also available in the simplify-gc branch. I've ran Salmonella against it, and it doesn't break anything: https://salmonella-freebsd-x86-64.call-cc.org/simplify-gc/clang/freebsd/x86-64/2020/04/18/salmonella-report/ And I also ran the benchmarks against this, and the performance stays the same (modulo some noise differences, as usual). Cheers, Peter
0001-Simplify-really_mark-to-be-a-bit-less-branchy.patch
Description: Text Data
0002-Also-convert-remark-into-really_mark-calls.patch
Description: Text Data
0003-Remove-a-few-unused-variables-from-rereclaim.patch
Description: Text Data
0004-Extract-out-the-marking-of-live-objects-common-to-al.patch
Description: Text Data
0005-Move-Cheney-algorithm-into-its-own-function.patch
Description: Text Data
0006-Fix-dir-locals-for-c-mode-indentation-depth.patch
Description: Text Data
signature.asc
Description: PGP signature
[Prev in Thread] | Current Thread | [Next in Thread] |