fix malloc-immobile-cell

This commit is contained in:
Matthew Flatt 2010-08-15 08:24:05 -06:00
parent 9c0c42f24a
commit cf9912c811
3 changed files with 13 additions and 3 deletions

View File

@ -1964,7 +1964,9 @@ static Scheme_Object *foreign_free(int argc, Scheme_Object *argv[])
#define MYNAME "malloc-immobile-cell" #define MYNAME "malloc-immobile-cell"
static Scheme_Object *foreign_malloc_immobile_cell(int argc, Scheme_Object *argv[]) static Scheme_Object *foreign_malloc_immobile_cell(int argc, Scheme_Object *argv[])
{ {
return scheme_make_foreign_external_cpointer(scheme_malloc_immobile_box(argv[0])); void *p;
p = scheme_malloc_immobile_box(argv[0]);
return scheme_make_foreign_external_cpointer(p); /* <- beware: macro duplicates `p' */
} }
#undef MYNAME #undef MYNAME

View File

@ -1387,7 +1387,9 @@ static void* SCHEME2C(Scheme_Object *type, void *dst, long delta,
/* (malloc-immobile-cell v) */ /* (malloc-immobile-cell v) */
@cdefine[malloc-immobile-cell 1]{ @cdefine[malloc-immobile-cell 1]{
return scheme_make_foreign_external_cpointer(scheme_malloc_immobile_box(argv[0])); void *p;
p = scheme_malloc_immobile_box(argv[0]);
return scheme_make_foreign_external_cpointer(p); /* <- beware: macro duplicates `p' */
} }
/* (free-immobile-cell b) */ /* (free-immobile-cell b) */

View File

@ -2854,7 +2854,8 @@ void GC_dump_with_traces(int flags,
{ {
NewGC *gc = GC_get_GC(); NewGC *gc = GC_get_GC();
mpage *page; mpage *page;
int i; int i, num_immobiles;
GC_Immobile_Box *ib;
static unsigned long counts[MAX_DUMP_TAG], sizes[MAX_DUMP_TAG]; static unsigned long counts[MAX_DUMP_TAG], sizes[MAX_DUMP_TAG];
reset_object_traces(); reset_object_traces();
@ -2934,6 +2935,10 @@ void GC_dump_with_traces(int flags,
} }
} }
num_immobiles = 0;
for (ib = gc->immobile_boxes; ib; ib = ib->next)
num_immobiles++;
GCPRINT(GCOUTF, "Begin Racket3m\n"); GCPRINT(GCOUTF, "Begin Racket3m\n");
for (i = 0; i < MAX_DUMP_TAG; i++) { for (i = 0; i < MAX_DUMP_TAG; i++) {
if (counts[i]) { if (counts[i]) {
@ -2998,6 +3003,7 @@ void GC_dump_with_traces(int flags,
GCWARN((GCOUTF,"# of minor collections: %li\n", gc->num_minor_collects)); GCWARN((GCOUTF,"# of minor collections: %li\n", gc->num_minor_collects));
GCWARN((GCOUTF,"# of installed finalizers: %i\n", gc->num_fnls)); GCWARN((GCOUTF,"# of installed finalizers: %i\n", gc->num_fnls));
GCWARN((GCOUTF,"# of traced ephemerons: %i\n", gc->num_last_seen_ephemerons)); GCWARN((GCOUTF,"# of traced ephemerons: %i\n", gc->num_last_seen_ephemerons));
GCWARN((GCOUTF,"# of immobile boxes: %i\n", num_immobiles));
if (flags & GC_DUMP_SHOW_TRACE) { if (flags & GC_DUMP_SHOW_TRACE) {
print_traced_objects(path_length_limit, get_type_name, get_xtagged_name, print_tagged_value); print_traced_objects(path_length_limit, get_type_name, get_xtagged_name, print_tagged_value);