]> granicus.if.org Git - gc/commitdiff
Fix GC_push_all/selected boundaries check
authorIvan Maidanski <ivmai@mail.ru>
Thu, 16 Feb 2012 18:47:28 +0000 (22:47 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 16 Feb 2012 18:47:28 +0000 (22:47 +0400)
* mark.c (GC_push_all, GC_push_selected): Properly check for empty
region after boundaries alignment (for the case when boundaries
unaligned and the region is short than one word); simplify the checked
condition.

mark.c

diff --git a/mark.c b/mark.c
index 15e570af124a6b60e15783918eee799f426616fc..62e38137687cffec9b9beac4866a600e75d555bc 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1260,7 +1260,8 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top)
 
     bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
     top = (ptr_t)(((word) top) & ~(ALIGNMENT-1));
-    if (top == 0 || bottom == top) return;
+    if (bottom >= top) return;
+
     GC_mark_stack_top++;
     if (GC_mark_stack_top >= GC_mark_stack_limit) {
         ABORT("Unexpected mark stack overflow");
@@ -1291,7 +1292,7 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top)
 
     bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
     top = (ptr_t)(((word) top) & ~(ALIGNMENT-1));
-    if (top == 0 || bottom == top) return;
+    if (bottom >= top) return;
 
     h = HBLKPTR(bottom + HBLKSIZE);
     if (top <= (ptr_t) h) {