From cd9ac97fb8d8eb092d96e7f3b5e913cb2990b6be Mon Sep 17 00:00:00 2001 From: theraven Date: Thu, 26 May 2011 18:30:39 +0000 Subject: [PATCH] Refine typed allocations slightly. --- gc_boehm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gc_boehm.c b/gc_boehm.c index aac5866..de4b9eb 100644 --- a/gc_boehm.c +++ b/gc_boehm.c @@ -225,11 +225,16 @@ static void collectIvarForClass(Class cls, GC_word *bitmap) : cls->instance_size; switch (ivar->type[0]) { + case '[': case '{': case '(': + // If the structure / array / union type doesn't contain any + // pointers, then skip it. We still need to be careful of packed + if ((strchr(ivar->type, '^') == 0) && + (strchr(ivar->type, '@') == 0)) + { + break; + } // Explicit pointer types case '^': case '@': - // We treat collections as pointer types for now, because people - // tend to do ugly things with them (especially unions!). - case '[': case '{': case '(': for (unsigned b=(start / sizeof(void*)) ; b<(end/sizeof(void*)) ; b++) { GC_set_bit(bitmap, b);