summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
AgeCommit message (Collapse)AuthorFilesLines
2008-09-10Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès1-4/+4
Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test
2008-09-10scm_gc_malloc: Handle zero-octet allocations.Ludovic Courtes1-1/+8
* libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2
2008-09-05Added `scm_gc_malloc_pointerless ()', equivalent to `GC_MALLOC_ATOMIC ()'.Ludovic Courtes1-1/+10
* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Tidied. (scm_gc_unregister_collectable_memory): Likewise. (scm_gc_malloc_pointerless): New. * libguile/gc.h (scm_gc_malloc_pointer_less): New declaration. * libguile/strings.c (make_stringbuf): Use it. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-5
2008-09-05Merge from lcourtes@laas.fr--2005-mobileLudovic Courtes1-143/+10
Patches applied: * lcourtes@laas.fr--2005-mobile/guile-core--boehm-gc--1.9 (base, patch 1) - tag of lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--base-0 - Initial hack for Boehm's GC support: nothing works. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-1
2008-08-21Style nitpicks: space before () in function call.Han-Wen Nienhuys1-5/+5
2008-08-16If realloc() fails in scm_realloc, then do a complete GC with completeHan-Wen Nienhuys1-13/+9
sweep directly.
2008-08-16Garbage collection cleanup.Han-Wen Nienhuys1-10/+14
* New file gc-segment-table.c: hold code for the segment table. * Remove data that might be out of date; remove scm_i_adjust_min_yield(). We don't store min_yields, since they are only accurate at one point in time (when the sweep finishes). We decide the min yield at that point from min_yield_fraction and freelist->collected / freelist->swept * Introduce scm_i_gc_heap_size_delta() replacing scm_i_gc_grow_heap_p(). * Remove foo_1 fields containing penultimate results. * After GC, count mark bit vector to discover number of live objects. This simplifies hairy updates. * Many formatting and layout cleanups. * Fix in scm_i_sweep_card(): return the length of free_list returned, rather than number of deleted objects. * For mtrigger GCs: do not also run a full sweep after the gc() call, as this is inconsistent with lazy sweeping. * Remove scm_i_make_initial_segment(). * Use calloc in scm_i_make_empty_heap_segment() to save on initialization code. * New function scm_i_sweep_for_freelist() which sweeps, with proper statistic variable updates. * New segments are conceptually blocks with 100% reclaimable cells. * Remove some useless constants/comments: SCM_HEAP_SIZE, SCM_INIT_HEAP_SIZE, SCM_EXPHEAP, SCM_HEAP_SEG_SIZE * Do not increment scm_cells_allocated() from the scm_[double]cell(). This would be a race condition. * Move some deprecation checks in separate functions to not distract from main code flow.
2008-02-15Release stuff: missing NEWS and 2007/2008 copyrights.Neil Jerram1-1/+1
2008-02-06(scm_gc_malloc): Return NULL if requested size is 0.Neil Jerram1-2/+3
(scm_gc_free): Don't call `free' if mem is NULL.
2006-04-17merge from 1.8 branchKevin Ryde1-1/+11
2006-02-14Ludovic's patch for scm_t_sweep_statistics.Han-Wen Nienhuys1-4/+6
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2005-03-10* gc.h, gc.c (SCM_FREECELL_P): Removed for good.Marius Vollmer1-4/+9
(scm_block_gc, scm_gc_heap_lock): Removed. Removed all uses. (scm_gc_running_p): Now a macro that refers to the scm_i_thread field. (scm_i_sweep_mutex): Now a non-recursive mutex. GC can not happen recursively. (scm_igc, scm_i_gc): Renamed former to latter. Changed all uses. Do not lock scm_i_sweep_mutex, which is now non-recursive, or set scm_gc_running_p. Do not run the scm_after_gc_c_hook. (scm_gc): Lock scm_i_sweep_mutex, set scm_gc_running_p and run the scm_after_gc_c_hook here. (scm_gc_for_new_cell): Set scm_gc_running_p here and run the scm_after_gc_c_hook when a full GC has in fact been performed. (scm_i_expensive_validation_check): Call scm_gc, not scm_i_gc. * gc-segment.c (scm_i_get_new_heap_segment): Do not check scm_gc_heap_lock. * gc-malloc.c (scm_realloc, increase_mtrigger): Set scm_gc_running_p while the scm_i_sweep_mutex is locked.
2005-03-02See ChangeLog from 2005-03-02.Marius Vollmer1-12/+10
2005-01-24Reverted changed from 2005/01/24 19:14:54, which was a commit to theMarius Vollmer1-10/+12
wrong branch. Sorry.
2005-01-24Threading changes.Marius Vollmer1-12/+10
2004-08-19* gc.h, gc.c (scm_i_gc_admin_mutex): New, to protectMarius Vollmer1-5/+19
scm_gc_mallocated, for now. (scm_init_storage): Initialize it. * gc-malloc.c (descrease_mtrigger, increase_mtrigger): Use it. * gc-mark.c (scm_gc_mark_dependencies): Call scm_i_string_mark, scm_i_stringbuf_mark and scm_i_symbol_mark, as appropriate. * gc-card.c (scm_i_sweep_card): Call scm_i_string_free, scm_i_stringbuf_free and scm_i_symbol_free, as appropriate.
2004-02-16Add a copyright year.Kevin Ryde1-1/+1
2004-02-16(scm_done_malloc, scm_done_free): Allow negative sizes,Kevin Ryde1-3/+9
which were permitted in the past for these.
2003-07-09(scm_gc_realloc): Define "ptr" at start of function.Kevin Ryde1-1/+3
2003-07-06(decrease_mtrigger): new functionHan-Wen Nienhuys1-13/+35
(increase_mtrigger): new function, separate debug registering and mtrigger administration. (scm_gc_realloc): bugfix: do mtrigger administration before the actual realloc, for the realloc might invalidate a GC-d segment of memory. Thanks to Sam Hocevar for pointing this out. (scm_gc_realloc): use scm_malloc_reregister instead of unregistering and registering in sequence.
2003-05-14(scm_gc_register_collectable_memory): avoidHan-Wen Nienhuys1-2/+11
wrap-around for scm_mtrigger (scm_gc_register_collectable_memory): abort on overflowing scm_mallocated().
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-35/+11
2003-03-25* gc-malloc.c: #include <config.h> if HAVE_CONFIG_H.Rob Browning1-0/+4
2002-12-21* gc.c, gc.h (scm_i_sweep_mutex): New mutex.Mikael Djurfeldt1-11/+15
* gc.c (scm_gc_for_newcell), gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory): Substitute locking of scm_i_sweep_mutex for calls to scm_i_thread_put_to_sleep. (scm_igc): Lock sweep mutex here instead of in callers; Calls to scm_i_thread_put_to_sleep/scm_i_thread_wake_up used to demarkate the single-thread section (which now only contains the mark phase). (scm_gc): Don't lock sweeo mutex here since scm_igc locks it; Removed SCM_DEFER/ALLOW_INTS. Simply call scm_igc directly. * threads.c (gc_section_mutex): Removed.
2002-12-11* gc-malloc.c, gc.h, init.c: Reverted gc-malloc change ofMikael Djurfeldt1-16/+0
2002-12-10.
2002-12-10* gc-malloc.c, gc.h (scm_gc_malloc_prehistory): New function.Mikael Djurfeldt1-3/+7
* gc-malloc.c (malloc_mutex): New mutex. (scm_gc_malloc_prehistory): Initialize it. (scm_realloc): Serialize call to realloc (scm_calloc): Same for calloc. Thanks to Wolfgang Jaehrling! (Now we have to make sure all calls to malloc/realloc are made through scm_malloc.) * init.c (scm_init_guile_1): Call scm_gc_malloc_prehistory.
2002-12-10* gc-malloc.c (malloc_mutex): New mutex.Mikael Djurfeldt1-0/+12
(scm_gc_init_malloc): Initialize it. (scm_realloc): Serialize call to realloc (scm_calloc): Same for calloc. Thanks to Wolfgang Jaehrling! (Now we have to make sure all calls to malloc/realloc are made through scm_malloc.)
2002-12-09* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.Mikael Djurfeldt1-3/+15
(SCM_NONREC_CRITICAL_SECTION_START, SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START, SCM_REC_CRITICAL_SECTION_END): New macros. (SCM_CRITICAL_SECTION_START/END): Defined here. * eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around the three calls to scm_m_expand_body. * gc.h: #include "libguile/pthread-threads.h"; (SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros. * gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type scm_t_key; * gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist access. * gc-freelist.c (scm_gc_init_freelist): Create freelist keys. * gc-freelist.c, threads.c (really_launch): Use SCM_FREELIST_CREATE. * gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory): * gc.c (scm_i_expensive_validation_check, scm_gc, scm_gc_for_newcell): Put threads to sleep before doing GC-related heap administration so that those pieces of code are executed single-threaded. We might consider rewriting these code sections in terms of a "call_gc_code_singly_threaded" construct instead of calling the pair of scm_i_thread_put_to_sleep () and scm_i_thread_wake_up (). Also, we would want to have as many of these sections eleminated. * init.c (scm_init_guile_1): Call scm_threads_prehistory. * inline.h: #include "libguile/threads.h" * pthread-threads.h: Macros now conform more closely to the pthreads interface. Some of them now take a second argument. * threads.c, threads.h: Many changes. * configure.in: Temporarily replaced "copt" threads option with new option "pthreads". (USE_PTHREAD_THREADS): Define if pthreads configured.
2002-09-09(scm_gc_register_collectable_memory): more overflowHan-Wen Nienhuys1-2/+2
protection.
2002-09-05* gc-segment.c (scm_i_make_initial_segment): check user settingsHan-Wen Nienhuys1-1/+12
for sanity. * gc-malloc.c (scm_gc_init_malloc): check user settings for sanity. (scm_gc_register_collectable_memory): prevent overflow of memory counts. * gc-freelist.c (scm_init_freelist): check user settings for sanity. * gc-malloc.c (scm_gc_register_collectable_memory): use floats; these won't ever wrap around with high memory usage. * gc-freelist.c: include <stdio.h> * gc-malloc.c: add DEBUGINFO for mtrigger GCs.
2002-09-05* struct.h: change scm_structs_to_free to scm_i_structs_to_freeHan-Wen Nienhuys1-2/+4
* gc-malloc.c (scm_gc_register_collectable_memory): use floats; these won't ever wrap around with high memory usage. * gc-malloc.c: add DEBUGINFO for mtrigger GCs.
2002-09-05add DEBUGINFO for mtrigger GCs.Han-Wen Nienhuys1-7/+7
2002-08-28* gc.h: remove DOUBLECELL card flags.Han-Wen Nienhuys1-1/+11
* gc-malloc.c (scm_calloc): try to use calloc() before calling scm_realloc(). * gc-segment.c (scm_i_initialize_heap_segment_data): remove card init loop; handle this from scm_init_card_freelist() * gc-card.c (scm_init_card_freelist): init bit vector here.
2002-08-08* gc-card.c ("sweep_card"): remove SCM_MISC_ERROR messages: printHan-Wen Nienhuys1-1/+4
message and abort. * gc-mark.c ("scm_gc_mark_dependencies"): idem.
2002-08-05* tests/reader.test: change misc-error in read-error.Han-Wen Nienhuys1-1/+13
* read.c (scm_input_error): new function: give meaningful error messages, and throw read-error * gc-malloc.c (scm_calloc): add scm_calloc. * scheme-memory.texi (Memory Blocks): add scm_calloc, scm_gc_calloc. correct typos.
2002-08-04(INPUT_ERROR): Prepare for file:line:column errorHan-Wen Nienhuys1-27/+16
messages for errors in scm_lreadr() and friends.
2002-08-04gc statistic tweaksHan-Wen Nienhuys1-5/+5
2002-08-04 more codeHan-Wen Nienhuys1-0/+407