summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-05-13 12:57:14 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-05-13 12:57:14 +0300
commit5f6df10a9317385b77d52ee2006f435639e87e44 (patch)
treec35043e983c356385cc7491b501d7611740cf1c3 /include
parentffc64167e4d0eccbee19794d7eac6b6946cddb63 (diff)
downloadbdwgc-5f6df10a9317385b77d52ee2006f435639e87e44.tar.gz
Make comparisons to the lowest heap boundary strict
* alloc.c (GC_expand_hp_inner): Subtract sizeof(word) from new_limit (for the case when comparing to GC_least_plausible_heap_addr). * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Compare current to GC_least_real_heap_addr and GC_greatest_real_heap_addr (instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr). * malloc.c [GC_ASSERTIONS] (GC_malloc_kind_global): Likewise. * include/gc/gc_mark.h (GC_MARK_AND_PUSH): Replace greater-or-equal to strictly greater when comparing to GC_least_plausible_heap_addr. * include/private/gc_pmark.h (GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Likewise. * include/private/gc_priv.h [MAKE_BACK_GRAPH] (SET_REAL_HEAP_BOUNDS, GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define. * mark.c (GC_mark_from, GC_push_all): Add dummy "| GC_DS_LENGTH" when storing length to mse_descr.w. * mark.c (GC_mark_from): Replace greater-or-equal to strictly greater when comparing to least_ha variable. * typd_mlc.c (GC_typed_mark_proc): Likewise. * mark.c [GC_DS_TAGS>ALIGNMENT-1] (GC_push_all): Simplify code to round up length.
Diffstat (limited to 'include')
-rw-r--r--include/gc/gc_mark.h2
-rw-r--r--include/private/gc_pmark.h8
-rw-r--r--include/private/gc_priv.h3
3 files changed, 7 insertions, 6 deletions
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