(let the client not to care about the alignment of excluded memory area)
* include/gc.h (GC_exclude_static_roots): Update the comment.
* mark_rts.c (GC_exclude_static_roots): Allow the lower boundary to be
unaligned as well; reverse boundary rounding direction (since the
boundaries specify exclusion region); update the comment.
/* need not be scanned. This is sometimes important if the application */
/* maps large read/write files into the address space, which could be */
/* mistaken for dynamic library data segments on some systems. */
-/* The section (referred to by low_address) must be pointer-aligned. */
-/* low_address must not be greater than high_address_plus_1. */
+/* Both section start and end are not needed to be pointer-aligned. */
GC_API void GC_CALL GC_exclude_static_roots(void * /* low_address */,
void * /* high_address_plus_1 */);
{
DCL_LOCK_STATE;
- /* Adjust the upper boundary for safety (round down) */
- e = (void *)((word)e & ~(sizeof(word) - 1));
-
if (b == e) return; /* nothing to exclude? */
+ /* Round boundaries (in direction reverse to that of GC_add_roots). */
+ b = (void *)((word)b & ~(sizeof(word) - 1));
+ e = (void *)(((word)e + (sizeof(word) - 1)) & ~(sizeof(word) - 1));
+ if (0 == e) e = (void *)(~(sizeof(word) - 1)); /* handle overflow */
+
LOCK();
GC_exclude_static_roots_inner(b, e);
UNLOCK();