summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorDaniel R. Grayson <dan@math.uiuc.edu>2012-01-26 05:42:33 +0100
committerIvan Maidanski <ivmai@mail.ru>2012-01-26 17:47:46 +0100
commita16036324480dfae2b094f0fa6567db1b867c617 (patch)
treeafc614874f5795b5682ff310ef18dbc2b9666954 /mark_rts.c
parentcebfd92286f10f4d6f8faaa73a5e61896a42d3ad (diff)
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 4cd97bd..5eb4d14 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 */