From: Ivan Maidanski Date: Sat, 16 Feb 2013 19:42:24 +0000 (+0400) Subject: Add assertion on number_of_objs to GC_extend_size_map X-Git-Tag: gc7_4_0~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5411aaba03ad6a4ca0ae2b72c437185a99ac3988;p=gc Add assertion on number_of_objs to GC_extend_size_map * misc.c (GC_extend_size_map): Add assertion for number_of_objs (result of integer division) to be non-zero (this assertion violation is observed in some Android emulators when gcc -march value does not match target CPU). --- diff --git a/misc.c b/misc.c index e6d31973..0697890a 100644 --- a/misc.c +++ b/misc.c @@ -240,9 +240,9 @@ STATIC void GC_init_size_map(void) /* We leave the rest of the array to be filled in on demand. */ } -/* Fill in additional entries in GC_size_map, including the ith one */ +/* Fill in additional entries in GC_size_map, including the ith one */ /* We assume the ith entry is currently 0. */ -/* Note that a filled in section of the array ending at n always */ +/* Note that a filled in section of the array ending at n always */ /* has length at least n/4. */ GC_INNER void GC_extend_size_map(size_t i) { @@ -277,9 +277,10 @@ GC_INNER void GC_extend_size_map(size_t i) granule_sz = MAXOBJGRANULES; } /* If we can fit the same number of larger objects in a block, */ - /* do so. */ + /* do so. */ { size_t number_of_objs = HBLK_GRANULES/granule_sz; + GC_ASSERT(number_of_objs != 0); granule_sz = HBLK_GRANULES/number_of_objs; granule_sz &= ~1; }