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
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
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
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
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
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
Han-Wen Nienhuys
b474ac33ee
Remove comments about removed variables.
2008-08-16 13:27:17 -03:00
Han-Wen Nienhuys
d09752ffd1
Introduce scm_i_marking to detect when GC mark bits are touched
...
outside of marking stage.
2008-08-16 13:21:42 -03:00
Han-Wen Nienhuys
e89b7b3625
Remove unused macro UNMARKED_CELL_P()
2008-08-16 13:21:32 -03:00
Han-Wen Nienhuys
569aa529d5
Use word_2 to store mark bits for freeing structs and vtables in the
...
correct order.
This ensures that we only use GC Marks during the actual GC Mark.
2008-08-16 13:21:21 -03:00
Han-Wen Nienhuys
51ef99f7fa
Fix memory corruption issue with hell[] array: realloc/calloc need to
...
factor in sizeof(scm_t_bits)
2008-08-16 02:32:00 -03:00
Han-Wen Nienhuys
01621bf62e
Include min-yields in gc-stats output.
2008-08-14 02:16:41 -03:00
Han-Wen Nienhuys
2072309c1c
Whitespace and formatting fixes.
...
Conflicts:
libguile/gc-freelist.c
libguile/gc-segment.c
libguile/gc.h
2008-08-14 01:51:24 -03:00
Neil Jerram
76dae88158
Fix misleading output from `(help rationalize)'
...
* numbers.c (scm_rationalize): Update docstring to match the
manual (which is more correct). Change argument "err" to "eps",
also to match the manual.
2008-08-03 00:27:32 +01:00
Neil Jerram
2b3df509f6
ChangeLog for "Improved MIPS/Linux gc_os_dep.c definitions"
2008-07-17 22:26:41 +01:00
Ludovic Courtès
450be18dff
Handle lack of struct dirent64' and
readdir64_r ()' on HP-UX 11.11.
2008-07-17 00:20:31 +02:00
Neil Jerram
c0a658c4db
Improved MIPS/Linux gc_os_dep.c definitions
...
From Thiemo Seufer <ths@networkno.de>:
* gc_os_dep.c (CPP_WORDSZ, ALIGN_DOUBLE, DATAEND,
DYNAMIC_LOADING): Added #defines.
(_fdata, _end): Added declarations.
(DATASTART): Use _fdata instead of __data_start.
(STACKBOTTOM): Changed from 0x80000000 to 0x7fff8000.
2008-07-12 19:33:21 +01:00
Ludovic Courtès
071bb6a840
Add `scm_c_symbol_length ()'.
2008-07-05 20:16:12 +02:00
Ludovic Courtès
b6137ed741
Don't declare scm_i_locale_mutex' as
SCM_INTERNAL'.
2008-07-04 22:22:06 +02:00
Ludovic Courtès
3e28462ffb
Fix `SCM_INTERNAL' with GCC 4.3.
2008-07-04 22:02:56 +02:00