Ludovic Courtes
febd2677c9
Generalized BGC's finalizer mechanism. Use it in `guardians.c'.
...
* libguile/gc.c (finalizer_trampoline): New.
(scm_gc_register_finalizer): New.
* libguile/gc.h (scm_gc_register_finalizer): New declaration.
* libguile/guardians.c (finalize_guarded): Updated to the new prototype.
(scm_i_guard): Use `scm_gc_register_finalizer ()' instead of
`GC_REGISTER_FINALIZER_NO_ORDER ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-23
2008-09-05 09:33:29 +02:00
Ludovic Courtes
378f262561
Added support for SMOB custom mark procedures.
...
* libguile/gc.c (scm_gc_mark): Removed.
(scm_gc_mark_dependencies): Removed.
(scm_mark_locations): Removed.
* libguile/gc.h (scm_gc_mark_dependencies): Removed.
(scm_mark_locations): Removed.
* libguile/inline.h (scm_cell): Use `GC_MALLOC ()' instead of `GC_malloc ()'.
* libguile/smob.c (smob_freelist): New.
(smob_gc_kind): New.
(smob_mark): New.
(scm_gc_mark): New.
(scm_i_new_smob_with_mark_proc): New.
(scm_smob_prehistory): Initialize `smob_freelist' and `smob_gc_kind'.
* libguile/smob.h (scm_i_new_smob_with_mark_proc): New declaration.
(SCM_NEWSMOB): Use it if a mark procedure is available.
(SCM_NEWSMOB2): Likewise.
(SCM_NEWSMOB3): Likewise.
* libguile/threads.c (guilify_self_1): Initialize the
`current_mark_stack_*' fields.
* libguile/threads.h (scm_i_thread)[current_mark_stack_ptr]: New field.
[current_mark_stack_limit]: New field.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-22
2008-09-05 09:33:20 +02:00
Ludovic Courtes
6bad09ba9f
Removed the mark/free functions of continuations and threads.
...
* libguile/continuations.c (continuation_mark): Removed.
(continuation_free): Removed.
(scm_init_continuations): Don't use them.
* libguile/coop-pthreads.c (scm_threads_mark_stacks): Removed (was
unused).
* libguile/threads.c (scm_threads_mark_stacks): Likewise.
* libguile/threads.h (scm_threads_mark_stacks): Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-21
2008-09-05 09:33:11 +02:00
Ludovic Courtes
296278188e
Removed useless files; beautified `libguile/Makefile.am'.
...
* libguile/Makefile.am: Beautified backslashification (complements `patch-1').
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-20
2008-09-05 00:51:00 +02:00
Ludovic Courtes
080ecf3f7b
Disabled the `environments' unit test.
...
* test-suite/Makefile.am (SCM_TESTS): Removed `tests/environments.test'.
* test-suite/tests/environments.nottest: Disabled.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-19
2008-09-05 00:48:47 +02:00
Ludovic Courtes
ce66606641
procs/weaks/hashtab: Removed a bit of useless mark/free code.
...
* libguile/hashtab.c (UNMARKED_CELL_P): Removed.
(scm_i_scan_weak_hashtables): Removed.
* libguile/hashtab.h (scm_i_scan_weak_hashtables): Removed.
* libguile/procs.c (scm_mark_subr_table): Removed.
* libguile/procs.h (scm_mark_subr_table): Removed.
* libguile/weaks.c (UNMARKED_CELL_P): Removed.
(scm_i_remove_weaks): Removed.
(scm_i_remove_weaks_from_weak_vectors): Removed.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-18
2008-09-05 00:48:31 +02:00
Ludovic Courtes
59cac9e3d8
Tiny updates in `environments.c'.
...
* libguile/environments.c (scm_make_environment): Use
`SCM_RETURN_NEWSMOB' instead of `scm_cell'.
(core_environments_observe): Use `SCM_NEWSMOB3' instead of
`scm_double_cell'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-17
2008-09-05 00:48:24 +02:00
Ludovic Courtes
741e83fcbf
Fixes in weak hash tables handling, notably in `hash-fold'.
...
* libguile/hashtab.c (scm_i_rehash): Return immediately if TABLE is weak.
(scm_hash_fn_create_handle_x): Explicitly mention that we don't support
weak alist vectors.
(scm_internal_hash_fold): Handle weak pairs within buckets.
* libguile/modules.c (scm_module_reverse_lookup): Handle weak alists
(currently, don't do anything if a NULL pair is met).
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-16
2008-09-05 00:48:16 +02:00
Ludovic Courtes
b6ed39c411
Fixed a typo/bug in `make-doubly-weak-alist-vector'.
...
* libguile/weaks.c (scm_make_doubly_weak_alist_vector): Fixed typo
(endless recursive call).
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-15
2008-09-05 00:48:11 +02:00
Ludovic Courtes
c367c4b44e
Fixed printing of weak vectors.
...
* libguile/print.c (iprin1): When displaying a weak vector, access
elements via `scm_c_vector_ref ()', not via the macro.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-14
2008-09-05 00:48:05 +02:00
Ludovic Courtes
d525e4f9a2
Fixed `list->weak-vector'.
...
* libguile/vectors.c (scm_i_allocate_weak_vector): Removed.
(MAKE_WEAK_VECTOR): New macro.
(allocate_weak_vector): New.
(scm_i_make_weak_vector): New.
(scm_i_make_weak_vector_from_list): New.
* libguile/vectors.h: Updated.
* libguile/weaks.c (scm_make_weak_vector): Use `scm_i_make_weak_vector ()'.
(scm_weak_vector): Use `scm_i_make_weak_vector_from_list ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-13
2008-09-05 00:48:01 +02:00
Ludovic Courtes
4650cdd20d
Fixed weak alist vectors by having them use weak hash tables instead.
...
* libguile/weaks.c (scm_make_weak_key_alist_vector): Use
`scm_make_weak_key_hash_table ()'.
(scm_make_weak_value_alist_vector): Use `scm_make_weak_value_hash_table ()'.
(scm_make_doubly_weak_alist_vector): Use `scm_make_doubly_weak_hash_table ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-12
2008-09-05 00:47:54 +02:00
Ludovic Courtes
bc700b6dd3
First stab at the guardian implementation. Works fine at first glance!
...
* libguile/guardians.c: Overhauled. Removed the `tconc' structure.
Much, much, simpler.
(finalize_guarded): New function.
* libguile/init.c (scm_i_init_guile): Call `scm_init_guardians ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-11
2008-09-05 00:47:24 +02:00
Ludovic Court`es
89f423d5ad
Tell `libgc' that we're using POSIX threads. This fixes Guile on PPC.
...
* libguile/coop-defs.h: If `GUILE_PTHREAD_COMPAT' is defined, then define
`GC_THREADS' and include <gc/gc.h> after <pthread.h>.
* libguile/coop-pthreads.h: Likewise.
* libguile/pthread-threads.h: Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-10
2008-09-05 00:47:11 +02:00
Ludovic Courtes
d9c82e2051
Fixed `scm_fixup_weak_alist ()'; update weak hash table size as needed.
...
* libguile/hashtab.c (scm_fixup_weak_alist): Added a REMOVED_ITEMS
parameter. Fixed a bug in the case where PREV is `SCM_EOL'.
(IS_WEAK_THING): New macro.
(START_WEAK_BUCKET_FIXUP): New macro.
(END_WEAK_BUCKET_FIXUP): New macro.
(scm_hash_fn_get_handle)[buckets]: New variable. Use the above
macros.
(scm_hash_fn_create_handle_x): Likewise.
(scm_hash_fn_remove_x): Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-9
2008-09-05 00:47:03 +02:00
Ludovic Courtes
e4d21e6bc9
Fixed the weak cell implementation (for weak hash tables).
...
* libguile/hashtab.c (wcar_cell_descr): New.
(wcdr_cell_descr): New.
(scm_weak_car_cell): Use `GC_malloc_explicitly_typed ()' instead of
`scm_gc_malloc_pointerless ()'.
(scm_weak_cdr_cell): Likewise.
(SCM_WEAK_CELL_WORD_DELETED_P): Use `SCM_CELL_OBJECT' instead of
`SCM_CELL_WORD'.
(scm_hash_fn_get_handle): Call `GC_disable ()' before calling
`scm_fixup_weak_alist ()' and `GC_enable ()' afterwards.
(scm_hash_fn_create_handle_x): Likewise.
(scm_hash_fn_remove_x): Likewise.
(scm_hashtab_prehistory): Initialize WCAR_CELL_DESCR and
WCDR_CELL_DESCR.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-8
2008-09-05 00:46:58 +02:00
Ludovic Courtes
3a2de079d5
First stab at implementing weak hash tables and vectors. Unable to run the REPL.
...
* libguile/hashtab.c (scm_weak_car_cell): New.
(scm_weak_cdr_cell): New.
(scm_doubly_weak_cell): New.
(SCM_WEAK_CELL_WORD_DELETED_P): New.
(SCM_WEAK_CELL_WORD): New.
(scm_fixup_weak_alist): New.
(make_hash_table): Always use non-weak vectors. Allocate
`scm_t_hashtable' objects as pointerless.
(scm_i_rehash): Always make NEW_BUCKETS a non-weak vector.
(scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak
buckets before calling ASSOC_FN.
(scm_hash_fn_remove_x): Likewise.
(scm_hash_fn_create_handle_x): Likewise. Also, use `scm_.*weak.*cell
()' for HANDLE when needed.
* libguile/symbols.c (lookup_interned_symbol): Check for nullified
pairs.
* libguile/vectors.c (scm_vector_elements): Abort on weak vectors.
(scm_vector_writable_elements): Likewise.
(scm_c_vector_ref): Check whether the referenced element has been
nullified.
(scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'.
(scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()'
instead of `scm_gc_malloc ()' when allocating room for the vector
itself.
* libguile/weaks.c (scm_make_weak_key_alist_vector): Use
`scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'.
(scm_make_weak_value_alist_vector): Likewise.
(scm_make_doubly_weak_alist_vector): Likewise.
(weak_vectors): Removed.
(scm_i_init_weak_vectors_for_gc): Removed.
(scm_i_mark_weak_vector): Removed.
(scm_i_mark_weak_vector_non_weaks): Removed.
(scm_i_mark_weak_vectors_non_weaks): Removed.
(scm_i_remove_weaks_from_weak_vectors): Commented out.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7
2008-09-05 00:46:53 +02:00
Ludovic Courtes
a82e795325
Fixed GC initialization and static roots.
...
* libguile/gc.c (scm_storage_prehistory): Call `GC_INIT ()'. Invoke
`GC_add_roots ()' as well.
(scm_init_gc): Removed call to `GC_init ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-6
2008-09-05 00:46:46 +02:00
Ludovic Courtes
c5018a2bbb
Added scm_gc_malloc_pointerless ()', equivalent to
GC_MALLOC_ATOMIC ()'.
...
* 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-05 00:46:40 +02:00
Ludovic Courtes
6a4be32986
Fixed garbage collection of ports: basics work (no SMOBs, no guardians, no WHT).
...
* libguile/gc.c (scm_init_storage): Do not initialize SCM_I_PORT_TABLE
here: this is done in `scm_ports_prehistory ()'. This fixes the bug
mentioned in the previous patch log.
* libguile/ports.c (scm_new_port_table_entry): Slightly clarified the
code.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-4
2008-09-05 00:46:22 +02:00
Ludovic Courtes
fca4388748
First `working'' Guile! Crashes in
flush-all-ports' (relates to SCM_I_PORT_TABLE).
...
* libguile/gc.c (scm_gc_stats): Fixed so that it returns a relevant
result instead of just `SCM_EOL'.
* libguile/ports.c: Include `assert.h'. Don't include `malloc.h'.
(scm_make_port_type): Use `scm_gc_realloc ()' instead of `realloc ()'.
(scm_new_port_table_entry): Likewise.
(scm_flush): Added an assertion on the port number.
(scm_ports_prehistory): Use `scm_gc_malloc ()' instead of `scm_malloc ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-3
2008-09-05 00:46:14 +02:00
Ludovic Courtes
c812243ba1
Small fixes. Gets to the REPL and `abort ()'s soon after.
...
* libguile/inline.h (scm_cell): Re-added comment about the assignment
order of CAR/CDR.
* libguile/srcprop.c (scm_make_srcprops): Use `scm_gc_malloc ()' instead
of `malloc' + `scm_gc_register_collectable_memory ()'.
* libguile/threads.c (guilify_self_1): Likewise.
(guilify_self_2): Likewise.
* libguile/strings.c (make_stringbuf): Use `GC_MALLOC_ATOMIC ()' instead
of `scm_gc_malloc ()'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-2
2008-09-05 00:46:07 +02:00
Ludovic Courtes
26224b3f5d
Merge from lcourtes@laas.fr--2005-mobile
...
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-09-05 00:45:58 +02:00
Ludovic Courtès
32e29e24b6
Update NEWS' wrt. the removal of
scm_i_' symbols.
2008-09-04 21:33:44 +02:00
Han-Wen Nienhuys
39d275916b
* eval.c: Mark #endif with comment.
2008-09-03 23:27:42 -03:00
Han-Wen Nienhuys
289cd1a720
Don't sanity check GC numbers on 64 bit platforms, while we
...
investigate a real fix.
2008-09-03 01:37:58 -03:00
Ludovic Courtès
4e641322d3
Fix compilation of `libguile-i18n' on NetBSD.
...
* libguile/i18n.c (str_upcase, str_downcase, scm_char_locale_downcase,
scm_char_locale_upcase): Cast chars to `int' when invoking `toupper ()'
et al. to avoid "array subscript has type 'char'" on NetBSD.
Reported by Greg Toxel <gdt@ir.bbn.com>.
2008-09-02 23:01:47 +02:00
Ludovic Courtès
69f23174d3
Use Gnulib's `strftime' to address bug #24130 .
...
* libguile/stime.c (scm_strftime): Use `nstrftime ()' from Gnulib.
This provides the same semantics on all platforms, thereby fixing
bug #24130 .
* doc/ref/posix.texi (Time): Remove note about non-portable `%Z'
behavior. Describe the new, portable behavior.
* test-suite/tests/time.test ("strftime")["strftime %Z doesn't return
garbage"]: Reinstate.
["C99 %z format"](have-strftime-%z): Remove.
("GMT", "EST+5"): Don't use `have-strftime-%z'.
2008-09-02 21:58:58 +02:00
Ludovic Courtès
e65fc94b7a
Add Gnulib `strftime' module, update Gnulib files.
...
* m4/gnulib-cache.m4 (gl_MODULES): Add `strftime'.
2008-09-02 21:16:10 +02:00
Julian Graham
37a5203955
Resolve a deadlock caused by not checking mutex state after calling `SCM_TICK'.
...
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2008-08-31 21:17:18 +02:00
Julian Graham
d0b6ad3491
Raise error on SRFI-18 load if Guile built without threading support
...
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2008-08-30 21:08:50 +02:00
Ludovic Courtès
cc39ff0ea1
Remove `coop-threads' files that had been useless since 2005-03-02.
2008-08-27 23:47:56 +02:00
Ludovic Courtès
70eca63557
Fix builds `--without-threads'.
2008-08-27 23:05:44 +02:00
Han-Wen Nienhuys
f85ea2a85f
Merge branch 'master' of git://git.sv.gnu.org/guile into nits
2008-08-26 23:48:20 -03:00
Han-Wen Nienhuys
487b9dec2e
Only sanity check numbers if SCM_DEBUG_CELL_ACCESSES is unset.
...
SCM_DEBUG_CELL_ACCESSES uses the mark bits for its own purposes.
2008-08-26 23:46:39 -03:00
Han-Wen Nienhuys
80237dcc77
Set SRCPROP{PLIST,COPY} through a macro, so SCM_DEBUG_CELL_ACCESSES compiles.
2008-08-26 22:47:19 -03:00
Ludovic Courtès
582a4997ab
Use $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
...
Gnulib code.
2008-08-25 22:11:53 +02:00
Ludovic Courtès
bfb2e11358
Use $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
...
Gnulib code.
2008-08-25 22:08:45 +02:00
Han-Wen Nienhuys
4b7513463d
Fix 2 indentation nitpicks.
2008-08-21 23:21:57 -03:00
Han-Wen Nienhuys
1f5844000e
Style nitpicks: space before () in function call.
2008-08-21 23:16:20 -03:00
Ludovic Courtès
103dc4d4d2
Add Gnulib-provided files for convenience.
...
These come from Gnulib's Git commit
ae3a0d62f26d8156b403e40d6007475006f3136f, dated 2008-08-19.
2008-08-21 22:23:59 +02:00
Ludovic Courtès
417566ebc9
Never define _GNU_SOURCE' explicitly since
AC_USE_SYSTEM_EXTENSIONS'
...
takes care of it.
Conflicts:
ChangeLog
configure.in
libguile/eval.c
libguile/srfi-14.c
libguile/threads.c
2008-08-20 19:31:46 +02:00
Ludovic Courtès
82d8d6d9e8
Add test case for the GOOPS `class-redefinition' memory corruption.
2008-08-20 00:44:20 +02:00
Ludovic Courtès
4a1db3a91f
Add ChangeLog and NEWS entry for the GOOPS `class-redefinition' memory
...
corruption fix.
2008-08-19 19:13:39 +02:00
Ludovic Courtès
bb764c0e3c
Complete fix of `hell' allocation in GOOPS.
2008-08-19 19:08:29 +02:00
Han-Wen Nienhuys
408bcd99d3
Fix sizeof() nitpick for goops corruption.
2008-08-18 11:19:59 -03:00
Han-Wen Nienhuys
5bfb683e12
Make marked conservatively statistic accumulative.
2008-08-16 15:34:04 -03:00
Han-Wen Nienhuys
676d9cc553
If realloc() fails in scm_realloc, then do a complete GC with complete
...
sweep directly.
2008-08-16 15:20:55 -03:00
Han-Wen Nienhuys
40945e5e9f
Add a statistic for tracking how many cells are marked conservatively.
...
This allows an informed choice for deciding how many segments to
create. After startup, ~2% of the cells are scanned conservatively.
2008-08-16 15:03:48 -03:00
Han-Wen Nienhuys
82ae1b8eb3
Garbage collection cleanup.
...
* 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-08-16 13:57:23 -03:00