GC_API void GC_CALL GC_clear_roots(void);
/* Add a root segment. Wizards only. */
-/* The segment (referred to by low_address) must be pointer-aligned. */
+/* Both segment start and end are not needed to be pointer-aligned. */
/* low_address must not be greater than high_address_plus_1. */
GC_API void GC_CALL GC_add_roots(void * /* low_address */,
void * /* high_address_plus_1 */);
{
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 */