Revert "Skip GC_DS_PER_OBJECT objs with negative descriptor in GC_mark_from"
authorIvan Maidanski <ivmai@mail.ru>
Thu, 19 Jan 2017 21:36:41 +0000 (00:36 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 19 Jan 2017 21:36:41 +0000 (00:36 +0300)
Issue #137 (bdwgc).

This reverts commit 57f36b93c1f1f2beb6bbbf0cb38c714b518abfdd.

Because it breaks gctest "list reversal" if compiled with
GC_GCJ_SUPPORT for MinGW/x86.  This is caused by the fact that static
data roots could be between two GC heap regions thus GC with the patch
skips scanning of a reachable GCJ object with a descriptor located in
the static data roots.

To fix the issue (#92) of mistaking the free list pointers in free
objects for being type descriptor pointers, another approach should be
taken (e.g. marking objects in free lists).

mark.c

diff --git a/mark.c b/mark.c
index 6fec7cd..dfeecc7 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -788,28 +788,6 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
                 mark_stack_top--;
                 continue;
             }
-            if ((GC_word)(type_descr) >= (GC_word)GC_least_plausible_heap_addr
-                    && (GC_word)(type_descr)
-                        <= (GC_word)GC_greatest_plausible_heap_addr) {
-                /* type_descr looks like a pointer into the heap.       */
-                /* It could still be the link pointer in a free list    */
-                /* though.  That's not a problem as long as the offset  */
-                /* of the actual descriptor in the pointed to object is */
-                /* within the same object.  In that case it will either */
-                /* point at the next free object in the list (if offset */
-                /* is 0) or be zeroed (which we check for below,        */
-                /* descr == 0).  If the offset is larger than the       */
-                /* objects in the block type_descr points to it cannot  */
-                /* be a proper pointer.                                 */
-                word offset = ~(descr + (GC_INDIR_PER_OBJ_BIAS
-                                         - GC_DS_PER_OBJECT - 1));
-                hdr *hhdr;
-                GET_HDR(type_descr, hhdr);
-                if (NULL == hhdr || hhdr->hb_sz - sizeof(word) < offset) {
-                    mark_stack_top--;
-                    continue;
-                }
-            }
             descr = *(word *)(type_descr
                               - (descr + (GC_INDIR_PER_OBJ_BIAS
                                           - GC_DS_PER_OBJECT)));