Commit 3ea03a11 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/gc: Improve mark/sweep debug output.

Previously, mark operation weren't logged at all, while it's quite useful
to see cascade of marks in case of over-marking (and in other cases too).
Previously, sweep was logged for each block of object in memory, but that
doesn't make much sense and just lead to longer output, harder to parse
by a human. Instead, log sweep only once per object. This is similar to
other memory manager operations, e.g. an object is allocated, then freed.
Or object is allocated, then marked, otherwise swept (one log entry per
operation, with the same memory address in each case).
parent fce0036a
......@@ -178,6 +178,7 @@ bool gc_is_locked(void) {
size_t _block = BLOCK_FROM_PTR(ptr); \
if (ATB_GET_KIND(_block) == AT_HEAD) { \
/* an unmarked head, mark it, and push it on gc stack */ \
DEBUG_printf("gc_mark(%p)\n", ptr); \
ATB_HEAD_TO_MARK(_block); \
*MP_STATE_MEM(gc_sp)++ = _block; \
......@@ -250,6 +251,7 @@ STATIC void gc_sweep(void) {
free_tail = 1;
DEBUG_printf("gc_sweep(%x)\n", PTR_FROM_BLOCK(block));
......@@ -257,7 +259,6 @@ STATIC void gc_sweep(void) {
case AT_TAIL:
if (free_tail) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment