[Gc] Patch for public R/W vars getters and setters

Boehm, Hans hans.boehm at hp.com
Fri Jun 12 15:12:36 PDT 2009


Thanks!  That was fast!

I committed the patch.

I think that most of the getters, as well as the setters that can be safely called after initialization should probably include a LOCK()/UNLOCK().  Otherwise we need to document them as usually requiring GC_call_with_alloc_lock() to avoid data races.  That assumes that none of them are called internally with the allocator lock already held ...

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ivan Maidanski
> Sent: Friday, June 12, 2009 4:08 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Patch for public R/W vars getters and setters
> 
> Hi!
> 
> This patch does (in major):
> - change the return type of the setters to void;
> - add getters accompanying the setters;
> - add setter/getter funcs for GC_find_leak and GC_non_gc_bytes.
> 
> Minor things (resembling diff45 and diff75 partly):
> - export GC_memalign();
> - fix use of GetModuleFileName/CreateFile;
> - add (and export) GC_ignore_warn_proc() for convenience.
> 
> ChangeLog entries:
> 
>         * misc.c (GC_set_oom_fn, GC_set_all_interior_pointers,
>         GC_set_finalize_on_demand, GC_set_java_finalization,
>         GC_set_finalizer_notifier, GC_set_dont_expand, 
> GC_set_full_freq,
>         GC_set_no_dls, GC_set_free_space_divisor, GC_set_max_retries,
>         GC_set_dont_precollect, GC_set_time_limit, GC_set_warn_proc):
>         Change return type to void (these API functions no 
> longer return
>         the old value).
>         * include/gc.h: Ditto (for prototypes).
>         * tests/test.c (main, WinMain, test): Remove explicit 
> cast to void
>         for GC_set_warn_proc().
>         * misc.c (GC_get_oom_fn, GC_get_all_interior_pointers,
>         GC_get_finalize_on_demand, GC_get_java_finalization,
>         GC_get_finalizer_notifier, GC_get_dont_expand, 
> GC_get_full_freq,
>         GC_get_no_dls, GC_get_free_space_divisor, GC_get_max_retries,
>         GC_get_dont_precollect, GC_get_time_limit, 
> GC_get_warn_proc): New
>         API functions (to get the current value of the 
> corresponding R/W
>         public variables).
>         * include/gc.h: Ditto (for prototypes).
>         * include/gc.h (GC_set_warn_proc, GC_set_free_space_divisor):
>         Update the comment.
>         * misc.c (GC_ignore_warn_proc): New API call-back function.
>         * include/gc.h (GC_ignore_warn_proc): Ditto (for the 
> prototype).
>         * misc.c (GC_set_find_leak, GC_get_find_leak, 
> GC_set_non_gc_bytes,
>         GC_get_non_gc_bytes): New API setter and getter 
> functions (for the
>         public GC_find_leak and GC_non_gc_bytes variables, 
> respectively).
>         * include/gc.h: Ditto (for prototypes).
>         * include/gc.h (GC_memalign): Add proto to GC API.
>         * mallocx.c (GC_memalign): Use GC_API, GC_CALL for 
> the definition.
>         * tests/test.c (run_one_test): Test GC_memalign() on 
> Win32 too,
>         remove GC_memalign() proto.
>         * misc.c (GC_write): Use multi-byte (A) variants of Win32
>         GetModuleFileName() and CreateFile().
>  	* test.c (main): Replace K&R-style function definition with the
>  	ANSI C one.
> 
> Bye.
> 


More information about the Gc mailing list