From 1991e9328f88d72818e6e8af853d0796c99ca188 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Thu, 29 Apr 2010 15:03:08 -0600 Subject: [PATCH] [Places] Tag allocate channels. mark message array --- src/racket/src/mzmarksrc.c | 1 + src/racket/src/places.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/racket/src/mzmarksrc.c b/src/racket/src/mzmarksrc.c index d7e8bce23f..989a484072 100644 --- a/src/racket/src/mzmarksrc.c +++ b/src/racket/src/mzmarksrc.c @@ -1379,6 +1379,7 @@ place_async_channel_val { mark: Scheme_Place_Async_Channel *pac = (Scheme_Place_Async_Channel *)p; int i; + gcMARK2(pac->msgs, gc); for (i = pac->size; i--; ) gcMARK2(pac->msgs[i], gc); diff --git a/src/racket/src/places.c b/src/racket/src/places.c index 3b6bc7e67b..5560f5c5db 100644 --- a/src/racket/src/places.c +++ b/src/racket/src/places.c @@ -909,11 +909,24 @@ static void* GC_master_malloc(size_t size) { return ptr; } +static void* GC_master_malloc_tagged(size_t size) { + void *ptr; +#ifdef MZ_PRECISE_GC + void *original_gc; + original_gc = GC_switch_to_master_gc(); +#endif + ptr = scheme_malloc_small_tagged(size); +#ifdef MZ_PRECISE_GC + GC_switch_back_from_master(original_gc); +#endif + return ptr; +} + Scheme_Object *scheme_place_async_channel_create() { Scheme_Object **msgs; Scheme_Place_Async_Channel *ch; - ch = GC_master_malloc(sizeof(Scheme_Place_Async_Channel)); + ch = GC_master_malloc_tagged(sizeof(Scheme_Place_Async_Channel)); msgs = GC_master_malloc(sizeof(Scheme_Object*) * 8); ch->so.type = scheme_place_async_channel_type; @@ -931,7 +944,7 @@ Scheme_Object *scheme_place_bi_channel_create() { Scheme_Object *tmp; Scheme_Place_Bi_Channel *ch; - ch = GC_master_malloc(sizeof(Scheme_Place_Bi_Channel)); + ch = GC_master_malloc_tagged(sizeof(Scheme_Place_Bi_Channel)); ch->so.type = scheme_place_bi_channel_type; tmp = scheme_place_async_channel_create(); @@ -944,7 +957,7 @@ Scheme_Object *scheme_place_bi_channel_create() { Scheme_Object *scheme_place_bi_peer_channel_create(Scheme_Object *orig) { Scheme_Place_Bi_Channel *ch; - ch = GC_master_malloc(sizeof(Scheme_Place_Bi_Channel)); + ch = GC_master_malloc_tagged(sizeof(Scheme_Place_Bi_Channel)); ch->so.type = scheme_place_bi_channel_type; ch->sendch = ((Scheme_Place_Bi_Channel *)orig)->recvch;