Author: Nicolas Truessel <[email protected]>
Branch: quad-color-gc
Changeset: r86662:a91d70d81b8d
Date: 2016-08-28 22:23 +0200
http://bitbucket.org/pypy/pypy/changeset/a91d70d81b8d/

Log:    Update QCGC codebase

diff --git a/rpython/translator/c/src/qcgc/arena.c 
b/rpython/translator/c/src/qcgc/arena.c
--- a/rpython/translator/c/src/qcgc/arena.c
+++ b/rpython/translator/c/src/qcgc/arena.c
@@ -162,9 +162,11 @@
 bool qcgc_arena_sweep(arena_t *arena) {
 #if CHECKED
        assert(arena != NULL);
+       assert(qcgc_arena_is_coalesced(arena));
 #endif
        bool free = true;
        bool coalesce = false;
+       bool add_to_free_list = false;
        size_t last_free_cell = QCGC_ARENA_FIRST_CELL_INDEX;
        for (size_t cell = QCGC_ARENA_FIRST_CELL_INDEX;
                        cell < QCGC_ARENA_CELLS_COUNT;
@@ -188,22 +190,27 @@
                                        last_free_cell = cell;
                                }
                                coalesce = true;
+                               add_to_free_list = true;
                                break;
                        case BLOCK_BLACK:
                                set_blocktype(arena, cell, BLOCK_WHITE);
-                               if (coalesce) {
+                               if (add_to_free_list) {
                                        
qcgc_fit_allocator_add(&(arena->cells[last_free_cell]),
                                                        cell - last_free_cell);
                                }
                                free = false;
                                coalesce = false;
+                               add_to_free_list = false;
                                break;
                }
        }
-       if (coalesce && !free) {
+       if (add_to_free_list && !free) {
                qcgc_fit_allocator_add(&(arena->cells[last_free_cell]),
                                                        QCGC_ARENA_CELLS_COUNT 
- last_free_cell);
        }
+#if CHECKED
+       assert(qcgc_arena_is_coalesced(arena));
+#endif
        return free;
 }
 
diff --git a/rpython/translator/c/src/qcgc/object.h 
b/rpython/translator/c/src/qcgc/object.h
--- a/rpython/translator/c/src/qcgc/object.h
+++ b/rpython/translator/c/src/qcgc/object.h
@@ -4,6 +4,10 @@
 #include "config.h"
 #include <stdint.h>
 
+/**
+ * The lower half of flags is reserved for the library, the upper half for
+ * clients
+ */
 #define QCGC_GRAY_FLAG (1<<0)
 #define QCGC_PREBUILT_OBJECT (1<<1)
 #define QCGC_PREBUILT_REGISTERED (1<<2)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to