diff options
-rw-r--r-- | alloc.c | 2 | ||||
-rw-r--r-- | backgraph.c | 12 | ||||
-rw-r--r-- | include/gc/gc_mark.h | 2 | ||||
-rw-r--r-- | include/private/gc_pmark.h | 8 | ||||
-rw-r--r-- | include/private/gc_priv.h | 3 | ||||
-rw-r--r-- | malloc.c | 8 | ||||
-rw-r--r-- | mark.c | 16 | ||||
-rw-r--r-- | typd_mlc.c | 2 |
8 files changed, 26 insertions, 27 deletions
@@ -1560,7 +1560,7 @@ GC_INNER GC_bool GC_expand_hp_inner(word n) GC_greatest_plausible_heap_addr = (void *)new_limit; } else { /* Heap is growing down. */ - word new_limit = (word)space - expansion_slop; + word new_limit = (word)space - expansion_slop - sizeof(word); if (new_limit < (word)space && (word)GC_least_plausible_heap_addr > new_limit) GC_least_plausible_heap_addr = (void *)new_limit; diff --git a/backgraph.c b/backgraph.c index fbd48d76..2cf551c8 100644 --- a/backgraph.c +++ b/backgraph.c @@ -356,12 +356,12 @@ static void add_back_edges(ptr_t p, size_t n_bytes, word gc_descr) LOAD_WORD_OR_CONTINUE(current, current_p); FIXUP_POINTER(current); - if (current >= (word)GC_least_plausible_heap_addr && - current < (word)GC_greatest_plausible_heap_addr) { - ptr_t target = (ptr_t)GC_base((void *)current); - if (0 != target) { - add_edge(p, target); - } + if (current > GC_least_real_heap_addr + && current < GC_greatest_real_heap_addr) { + ptr_t target = (ptr_t)GC_base((void *)current); + + if (target != NULL) + add_edge(p, target); } } } diff --git a/include/gc/gc_mark.h b/include/gc/gc_mark.h index acec052b..330d6f4b 100644 --- a/include/gc/gc_mark.h +++ b/include/gc/gc_mark.h @@ -158,7 +158,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void * /* obj */, void ** /* src */); #define GC_MARK_AND_PUSH(obj, msp, lim, src) \ - ((GC_word)(obj) >= (GC_word)GC_least_plausible_heap_addr \ + ((GC_word)(obj) > (GC_word)GC_least_plausible_heap_addr \ && (GC_word)(obj) < (GC_word)GC_greatest_plausible_heap_addr ? \ GC_mark_and_push(obj, msp, lim, src) : (msp)) diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h index 286bf179..bbee8729 100644 --- a/include/private/gc_pmark.h +++ b/include/private/gc_pmark.h @@ -380,12 +380,12 @@ GC_INLINE mse * GC_push_contents_hdr(ptr_t current, mse * mark_stack_top, /* Try both the raw version and the fixed up one. */ # define GC_PUSH_ONE_STACK(p, source) \ do { \ - if ((word)(p) >= (word)GC_least_plausible_heap_addr \ + if ((word)(p) > (word)GC_least_plausible_heap_addr \ && (word)(p) < (word)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } \ FIXUP_POINTER(p); \ - if ((word)(p) >= (word)GC_least_plausible_heap_addr \ + if ((word)(p) > (word)GC_least_plausible_heap_addr \ && (word)(p) < (word)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } \ @@ -393,7 +393,7 @@ GC_INLINE mse * GC_push_contents_hdr(ptr_t current, mse * mark_stack_top, #else /* !NEED_FIXUP_POINTER */ # define GC_PUSH_ONE_STACK(p, source) \ do { \ - if ((word)(p) >= (word)GC_least_plausible_heap_addr \ + if ((word)(p) > (word)GC_least_plausible_heap_addr \ && (word)(p) < (word)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } \ @@ -404,7 +404,7 @@ GC_INLINE mse * GC_push_contents_hdr(ptr_t current, mse * mark_stack_top, #define GC_PUSH_ONE_HEAP(p,source,mark_stack_top) \ do { \ FIXUP_POINTER(p); \ - if ((word)(p) >= (word)GC_least_plausible_heap_addr \ + if ((word)(p) > (word)GC_least_plausible_heap_addr \ && (word)(p) < (word)GC_greatest_plausible_heap_addr) \ mark_stack_top = GC_mark_and_push((void *)(p), mark_stack_top, \ GC_mark_stack_limit, (void * *)(source)); \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 84bcc14c..dc442afb 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1448,7 +1448,8 @@ struct _GC_arrays { /* obtained scratch area. */ /* Used by GC_register_dynamic_libraries(). */ # endif -# if defined(GC_ASSERTIONS) || (defined(KEEP_BACK_PTRS) && ALIGNMENT == 1) +# if defined(GC_ASSERTIONS) || defined(MAKE_BACK_GRAPH) \ + || (defined(KEEP_BACK_PTRS) && ALIGNMENT == 1) # define SET_REAL_HEAP_BOUNDS # define GC_least_real_heap_addr GC_arrays._least_real_heap_addr # define GC_greatest_real_heap_addr GC_arrays._greatest_real_heap_addr @@ -324,11 +324,9 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_kind_global(size_t lb, int k) if (k == PTRFREE) { *opp = obj_link(op); } else { - GC_ASSERT(0 == obj_link(op) - || ((word)obj_link(op) - < (word)GC_greatest_plausible_heap_addr - && (word)obj_link(op) - >= (word)GC_least_plausible_heap_addr)); + GC_ASSERT(NULL == obj_link(op) + || ((word)obj_link(op) < GC_greatest_real_heap_addr + && (word)obj_link(op) > GC_least_real_heap_addr)); *opp = obj_link(op); obj_link(op) = 0; } @@ -629,7 +629,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, word new_size = (descr/2) & ~(word)(sizeof(word)-1); mark_stack_top -> mse_start = current_p; - mark_stack_top -> mse_descr.w = new_size + sizeof(word); + mark_stack_top -> mse_descr.w = + (new_size + sizeof(word)) | GC_DS_LENGTH; /* Makes sure we handle */ /* misaligned pointers. */ mark_stack_top++; @@ -682,7 +683,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if ((descr & SIGNB) == 0) continue; LOAD_WORD_OR_CONTINUE(current, current_p); FIXUP_POINTER(current); - if (current >= (word)least_ha && current < (word)greatest_ha) { + if (current > (word)least_ha && current < (word)greatest_ha) { PREFETCH((ptr_t)current); # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { @@ -781,7 +782,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, deferred = *(word *)limit; FIXUP_POINTER(deferred); limit -= ALIGNMENT; - if (deferred >= (word)least_ha && deferred < (word)greatest_ha) { + if (deferred > (word)least_ha && deferred < (word)greatest_ha) { PREFETCH((ptr_t)deferred); break; } @@ -791,7 +792,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, deferred = *(word *)limit; FIXUP_POINTER(deferred); limit -= ALIGNMENT; - if (deferred >= (word)least_ha && deferred < (word)greatest_ha) { + if (deferred > (word)least_ha && deferred < (word)greatest_ha) { PREFETCH((ptr_t)deferred); break; } @@ -806,7 +807,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, LOAD_WORD_OR_CONTINUE(current, current_p); FIXUP_POINTER(current); PREFETCH(current_p + PREF_DIST*CACHE_LINE_SIZE); - if (current >= (word)least_ha && current < (word)greatest_ha) { + if (current > (word)least_ha && current < (word)greatest_ha) { /* Prefetch the contents of the object we just pushed. It's */ /* likely we will need them soon. */ PREFETCH((ptr_t)current); @@ -1274,11 +1275,10 @@ GC_API void GC_CALL GC_push_all(void *bottom, void *top) } length = (word)top - (word)bottom; # if GC_DS_TAGS > ALIGNMENT - 1 - length += GC_DS_TAGS; - length &= ~GC_DS_TAGS; + length = (length + GC_DS_TAGS) & ~GC_DS_TAGS; /* round up */ # endif GC_mark_stack_top -> mse_start = (ptr_t)bottom; - GC_mark_stack_top -> mse_descr.w = length; + GC_mark_stack_top -> mse_descr.w = length | GC_DS_LENGTH; } #ifndef GC_DISABLE_INCREMENTAL @@ -178,7 +178,7 @@ STATIC mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr, LOAD_WORD_OR_CONTINUE(current, current_p); FIXUP_POINTER(current); - if (current >= (word)least_ha && current < (word)greatest_ha) { + if (current > (word)least_ha && current < (word)greatest_ha) { PUSH_CONTENTS((ptr_t)current, mark_stack_ptr, mark_stack_limit, current_p); } |