From d53b6dfbbb335dba60ef960e7e3abee10dcd9ed9 Mon Sep 17 00:00:00 2001 From: ivmai Date: Mon, 23 May 2011 15:18:04 +0000 Subject: [PATCH] 2011-05-23 Ivan Maidanski * mark.c (GC_dirty): Add prototype (only if MANUAL_VDB). * stubborn.c (GC_dirty): Ditto. * include/private/gcconfig.h (GWW_VDB, MPROTECT_VDB, PCR_VDB, PROC_VDB): Undefine if MANUAL_VDB. * include/private/gcconfig.h (DEFAULT_VDB): Don't define if MANUAL_VDB. * os_dep.c (async_set_pht_entry_from_index): Define for MANUAL_VDB. * os_dep.c (GC_read_dirty): Set GC_dirty_maintained only if success; if ioctl() failed then just print warning instead of aborting. --- ChangeLog | 14 ++++++++++++++ include/private/gcconfig.h | 8 ++++++-- mark.c | 8 ++++++-- os_dep.c | 10 ++++++++-- stubborn.c | 2 ++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ac4b61..c49fc46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-05-23 Ivan Maidanski + * mark.c (GC_dirty): Add prototype (only if MANUAL_VDB). + * stubborn.c (GC_dirty): Ditto. + * include/private/gcconfig.h (GWW_VDB, MPROTECT_VDB, PCR_VDB, + PROC_VDB): Undefine if MANUAL_VDB. + * include/private/gcconfig.h (DEFAULT_VDB): Don't define if + MANUAL_VDB. + * os_dep.c (async_set_pht_entry_from_index): Define for + MANUAL_VDB. + * os_dep.c (GC_read_dirty): Set GC_dirty_maintained only if + success; if ioctl() failed then just print warning instead of + aborting. + +2011-05-23 Ivan Maidanski + * include/private/gc_priv.h (GC_ASSERT): Use "%d" (instead of %ld) for line number printing. diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 5cd3672..bd99e6d 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2380,11 +2380,14 @@ # define GC_DISABLE_INCREMENTAL #endif -#ifdef GC_DISABLE_INCREMENTAL +#if defined(GC_DISABLE_INCREMENTAL) || defined(MANUAL_VDB) # undef GWW_VDB # undef MPROTECT_VDB # undef PCR_VDB # undef PROC_VDB +#endif + +#ifdef GC_DISABLE_INCREMENTAL # undef CHECKSUMS #endif @@ -2413,7 +2416,8 @@ #endif #if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \ - && !defined(GWW_VDB) && !defined(GC_DISABLE_INCREMENTAL) + && !defined(GWW_VDB) && !defined(MANUAL_VDB) \ + && !defined(GC_DISABLE_INCREMENTAL) # define DEFAULT_VDB #endif diff --git a/mark.c b/mark.c index aff1e2f..6581108 100644 --- a/mark.c +++ b/mark.c @@ -1396,6 +1396,10 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, return mark_stack_ptr; } +#if defined(MANUAL_VDB) && defined(THREADS) + void GC_dirty(ptr_t p); +#endif + /* Mark and push (i.e. gray) a single object p onto the main */ /* mark stack. Consider p to be valid if it is an interior */ /* pointer. */ @@ -1431,8 +1435,8 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, } # if defined(MANUAL_VDB) && defined(THREADS) /* Pointer is on the stack. We may have dirtied the object */ - /* it points to, but not yet have called GC_dirty(); */ - GC_dirty(p); /* Implicitly affects entire object. */ + /* it points to, but not yet have called GC_dirty(); */ + GC_dirty(p); /* Implicitly affects entire object. */ # endif PUSH_CONTENTS_HDR(r, GC_mark_stack_top, GC_mark_stack_limit, source, mark_and_push_exit, hhdr, FALSE); diff --git a/os_dep.c b/os_dep.c index c65d93a..21613d9 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2850,6 +2850,9 @@ STATIC void GC_default_push_other_roots(void) return(HDR(h) == 0 || get_pht_entry_from_index(GC_grungy_pages, index)); } +# define async_set_pht_entry_from_index(db, index) \ + set_pht_entry_from_index(db, index) /* for now */ + /* Mark the page containing p as dirty. Logically, this dirties the */ /* entire object. */ void GC_dirty(ptr_t p) @@ -3600,7 +3603,6 @@ GC_INNER void GC_dirty_init(void) int fd; char buf[30]; - GC_dirty_maintained = TRUE; if (GC_bytes_allocd != 0 || GC_bytes_allocd_before_gc != 0) { memset(GC_written_pages, 0xff, sizeof(page_hash_table)); if (GC_print_stats == VERBOSE) @@ -3608,6 +3610,7 @@ GC_INNER void GC_dirty_init(void) (unsigned long)(GC_bytes_allocd + GC_bytes_allocd_before_gc)); } + sprintf(buf, "/proc/%ld", (long)getpid()); fd = open(buf, O_RDONLY); if (fd < 0) { @@ -3617,8 +3620,11 @@ GC_INNER void GC_dirty_init(void) close(fd); syscall(SYS_fcntl, GC_proc_fd, F_SETFD, FD_CLOEXEC); if (GC_proc_fd < 0) { - ABORT("/proc ioctl failed"); + WARN("/proc ioctl(PIOCOPENPD) failed", 0); + return; } + + GC_dirty_maintained = TRUE; GC_proc_buf = GC_scratch_alloc(GC_proc_buf_size); } diff --git a/stubborn.c b/stubborn.c index a297dd5..b1991f1 100644 --- a/stubborn.c +++ b/stubborn.c @@ -22,6 +22,8 @@ /* written, but not yet GC_dirty()ed objects must be referenced */ /* by a stack. */ + void GC_dirty(ptr_t p); + GC_API void * GC_CALL GC_malloc_stubborn(size_t lb) { return(GC_malloc(lb)); -- 2.7.4