Make garbage collection more conservative
commite13bdfee1742a7cc1eff5dc3bfbe2d71ea3532ef
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Aug 2017 21:35:37 +0000 (29 14:35 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Aug 2017 21:58:49 +0000 (29 14:58 -0700)
tree2ee472fe616200a44f1c88fb21c1717c215893f8
parent9baeed3514fe60189f3bf935c380da92659b7f59
Make garbage collection more conservative

Check for a pointer anywhere within the object, as opposed to just
the start of the object.  This is needed for gcc -Os -flto on
x86-64 (Bug#28213).  This change means that the garbage collector
is more conservative, and will incorrectly keep objects that it
does not need to, but that is better than incorrectly discarding
objects that should be kept.
* src/alloc.c (ADVANCE, VINDEX): Now functions, not macros;
this is easier to debug.
(setup_on_free_list): Rename from SETUP_ON_FREE_LIST.
Now a function with two args, not a macro with three.
All callers changed.
(live_string_holding, live_cons_holding, live_symbol_holding)
(live_misc_holding, live_vector_holding, live_buffer_holding):
New functions, which check for any object containing the addressed
byte, not just for an object at the given address.
(live_string_p, live_cons_p, live_symbol_p, live_misc_p)
(live_vector_p, live_buffer_p):
Redefine in terms of the new functions.
(live_float_p): Refactor slightly to match the new functions.
(mark_maybe_object, mark_maybe_pointer): Use the new functions.
Don’t bother checking mark bits, as mark_object already does that,
and omitting the checks here simplifies the code.  Although
mark_maybe_object can continue to insist that tagged pointers
still address the start of the object, mark_maybe_pointer now is
more conservative and checks for pointers anywhere into an object.
src/alloc.c