summaryrefslogtreecommitdiff
path: root/mark.c
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 /mark.c
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 'mark.c')
-rw-r--r--mark.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mark.c b/mark.c
index ffc66956..a366091a 100644
--- a/mark.c
+++ b/mark.c
@@ -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