summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorDaniel R. Grayson <dan@math.uiuc.edu>2012-01-26 08:42:33 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-01-26 12:49:47 +0400
commit213ea998f0f01c7fc3cb9fa836eac7e7b6a69af0 (patch)
treedd6ec9872e306622492354f688daed5da6f268af /mark_rts.c
parent75d55778f20ed01aa6c9e8dd8fd12912fa82e3cc (diff)
downloadbdwgc-213ea998f0f01c7fc3cb9fa836eac7e7b6a69af0.tar.gz
Fix GC_add_roots_inner for Mac OS X (enable GC_dyld_image_add to
pass unaligned segment start to GC_add_roots) * mark_rts.c (GC_add_roots_inner): Round "b" pointer up to word boundary. * include/gc.h (GC_add_roots): Update the comment.
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mark_rts.c b/mark_rts.c
index b7b81320..58f31df2 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -156,11 +156,12 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
{
struct roots * old;
- /* Adjust and check range boundaries for safety */
- GC_ASSERT((word)b % sizeof(word) == 0);
- e = (ptr_t)((word)e & ~(sizeof(word) - 1));
GC_ASSERT(b <= e);
- if (b == e) return; /* nothing to do? */
+ b = (ptr_t)(((word)b + (sizeof(word) - 1)) & ~(sizeof(word) - 1));
+ /* round b up to word boundary */
+ e = (ptr_t)((word)e & ~(sizeof(word) - 1));
+ /* round e down to word boundary */
+ if (b >= e) return; /* nothing to do */
# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
/* Spend the time to ensure that there are no overlapping */