1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

400 commits

Author SHA1 Message Date
Michael Livshin
d6884e6373 * gc.c: (scm_default_init_heap_size_*): defined to take cards into
account, but keeping more or less the same values as previously.
added some simple helper macros.
(CLUSTER_SIZE_IN_BYTES, ALIGNMENT_SLACK): defined to take cards
into account.
(BVEC_*, scm_mark_space_t, current_mark_space, mark_space_ptr,
current_mark_space_offset, mark_space_head, get_bvec,
clear_mark_space): new functions and supporting variables, types
and macros that implement mark space management.
(scm_igc): clear the mark space (all of it) before beginning the
mark phase.
(scm_gc_mark): changed the tests for rogue cells, much simplified
throughout (no different mark bit locations to worry about now).
(scm_mark_locations): don't consider card header cells.
(scm_cellp): ditto.
(scm_gc_sweep): simplified.
(init_heap_seg): changed to take cards into account.
2000-08-17 20:38:44 +00:00
Michael Livshin
c9b0d4b090 * gc.c (scm_gc_stats): add more obscure stats, such as: mark time,
sweep time, total marked cells, total swept cells, and number of
times GC was invoked.
(gc_start_stats): renamed from scm_gc_start, made static, taught
to init the new stats.
(gc_end_stats): renamed from scm_gc_end, made static, taught to
calculate the new stats.
(scm_igc): don't call gc_start_stats unless we are sure that we
are indeed going to collect.  also, added some timekeeping between
the mark and sweep phases.
(scm_gc_sweep): count number of cells we sweep as we go.

* gc.h: removed prototypes for scm_gc_{start,end}.
2000-08-16 00:23:18 +00:00
Mikael Djurfeldt
7445e0e8eb * gc.c (scm_gc_mark, scm_gc_sweep): Remove vcell = 1 magic.
(scm_structs_to_free): New variable.
(scm_gc_sweep): Hook up structs to free on the scm_structs_to_free
chain.
2000-08-09 18:29:10 +00:00
Dirk Herrmann
1110299262 * Renamed local variable 'free' to avoid confusion with stdlib's 'free'. 2000-07-26 11:29:58 +00:00
Michael Livshin
9d47a1e6f2 * gc.c (scm_done_free): new.
expanded comments about scm_done_malloc.

* gc.h: added prototype for scm_done_free
2000-07-15 13:44:04 +00:00
Dirk Herrmann
406c7d9022 * Extend checks performed with SCM_DEBUG_CELL_ACCESSES=1 and make them
configurable at run-time.
* Replace SCM_FREEP by SCM_FREE_CELL_P and scm_gc_heap_lock by
  scm_gc_running_p (not in all places yet).
2000-07-13 15:00:58 +00:00
Dirk Herrmann
c4da09e2dd * Minor cleanups in scm_mark_locations. 2000-07-13 07:40:04 +00:00
Dirk Herrmann
3f5d82cd9a * Use a set of dedicated macros to access and modify free cells. 2000-07-10 14:25:53 +00:00
Dirk Herrmann
b6efc9510e * Keep track of the heap segment table size.
* Let the caller of alloc_some_heap determine the behaviour in case of
  malloc failures.  Use this feature in scm_gc_for_newcell.
2000-07-06 09:10:22 +00:00
Dirk Herrmann
c73879189d * Improved memory error handling.
* Made the behaviour of scm_gc_for_newcell more obvious.
2000-06-30 13:48:28 +00:00
Mikael Djurfeldt
83d58c8257 * gc.c (scm_gc_for_newcell): Behave gracefully also if scm_igc
doesn't yield any new cells.  In theory this could happen if all
cells allocated with NEWCELL are either in use or conservatively
marked and all cluster spine cells are conservatively marked.
(Thanks to Dirk.)
2000-06-29 23:46:59 +00:00
Dirk Herrmann
acf4331fa5 * Use appropriate error signalling functions. 2000-06-29 13:31:33 +00:00
Dirk Herrmann
0a7a74453e * Removed unused identifier MIN_GC_YIELD. 2000-06-29 08:27:40 +00:00
Michael Livshin
150c200bdd * gc.c (scm_gc_for_newcell): don't try to do GC if it's blocked,
allocate instead.
2000-06-28 13:17:11 +00:00
Dirk Herrmann
939794ce7f * Cleaned up initialization of asyncs.
* Moved handling of scm_gc_async to gc.c.
* Extracted handling of scheme level after-gc-hook from gc core.
2000-06-28 10:26:52 +00:00
Dirk Herrmann
12acbbef54 * Removed commented code from gc.c.
* Removed unused identifier scm_type_obj_list.
2000-06-28 07:49:25 +00:00
Mikael Djurfeldt
aeacfc8fd1 * gc.c, gc.h (scm_default_init_heap_size_1,
scm_default_min_yield_1, scm_default_init_heap_size_2,
scm_default_min_yield_2, scm_default_max_segment_size): New global
variables.  Can be customized by the application before booting
Guile.  (We might want to be able to control these parameters
dynamically through the "options interface" in the future, but
note that that is additional functionality.  Here we're giving
default values which the environment variables can override.)
2000-06-20 02:37:23 +00:00
Mikael Djurfeldt
7bd4fbe2de * gc.c (scm_protect_object): Updated comment. 2000-06-19 10:03:57 +00:00
Dirk Herrmann
6a19994066 * The reference count in scm_unprotect_object is always positive. 2000-06-15 08:35:42 +00:00
Mikael Djurfeldt
0f0f08998d * gc.c (scm_protect_object): Avoid looking up the object handle
twice.
(scm_unprotect_object): Abort if scm_unprotect_object is called on
an unprotected object.
2000-06-14 15:00:52 +00:00
Michael Livshin
2dd6a83aed * gc.c (scm_unprotect_object): fix a nasty typo bug (thanks to
Dirk Herrmann).
2000-06-14 14:21:49 +00:00
Dirk Herrmann
9a09deb1c3 * Removed SCM_TRUE_P since it may get confused with !SCM_FALSEP. 2000-06-05 11:39:46 +00:00
Dirk Herrmann
f8eaf8b9a3 * Restored the old behaviour of scm_create_hook. 2000-05-29 07:57:31 +00:00
Dirk Herrmann
e11f8b42f2 * The name property of hooks is deprecated. 2000-05-26 16:31:22 +00:00
Dirk Herrmann
47457e8a43 * Replace SCM_UNPACK_CAR appropriately.
* Only access cons cells via SCM_{SET}?C[AD]R.
* gc.c:  Remove unused struct member variable 'valid'.
2000-05-25 09:21:06 +00:00
Dirk Herrmann
206d3de31e * Replace SCM_UNPACK_CAR appropriately. 2000-05-23 22:23:56 +00:00
Dirk Herrmann
6ba93e5e88 * Deprecated some unused SCM_NxxxP macros.
* Removed conditionally compiled code depending on 'nosve'.
2000-05-23 15:20:54 +00:00
Michael Livshin
fe517a7d3d * gc.c (scm_heap_seg_data_t): fixed comment for the `span' member. 2000-05-23 12:26:55 +00:00
Michael Livshin
686765af61 * gc.h (SCM_[SET_]CELL_{WORD,OBJECT}, SCM_VALIDATE_CELL): brought
the yucky, ugly and nasty conditional compilation back.  sorry,
but it was either that or requiring GAWK to build Guile.
removed the code that implemented the old GC scheme.

* init.c (scm_boot_guile_1): removed the code conditioned on
!GUILE_NEW_GC_SCHEME.

* __scm.h: (GUILE_NEW_GC_SCHEME): removed.

* gc.c (scm_protect_object, scm_unprotect_object): change the
implementation to more efficient (at least in the time complexity
sense).  the calls should now also be thread-safe -- I suspect
that people expect them to be.  (thanks to Han-Wen Nienhuys)
removed the code that implemented the old GC scheme.

* hashtab.c (scm_hash_fn_create_handle_x): add missing
SCM_REALLOW_INTS before return.
2000-05-21 20:49:20 +00:00
Dirk Herrmann
1a548472dd * gc.c (scm_cellp): Fixed and simplified.
* Using double cells to represent jump buffers with debug extensions.
2000-05-19 14:03:44 +00:00
Mikael Djurfeldt
801cb5e7ce * gc.c: Removed #include "libguile/guardians.h".
(scm_before_gc_c_hook, scm_before_mark_c_hook,
scm_before_sweep_c_hook, scm_after_sweep_c_hook,
scm_after_gc_c_hook): New C level hooks.
(scm_after_gc_hook): New Scheme level hook.
(scm_gc_sweep): Moved scanning of weak vectors to weaks.c.
(scm_igc): Moved initialization of scm_weak_vectors and the call
to scm_guardian_gc_init to respective module.
(scm_mark_weak_vector_spines): Moved to weaks.c;
Call to scm_guardian_zombify moved to guardians.c;
Run scm_before_gc_c_hook, scm_before_sweep_c_hook,
scm_after_gc_c_hook at appropriate places.
(scm_init_gc): Initialize scm_after_gc_hook.
2000-04-21 23:11:29 +00:00
Mikael Djurfeldt
a059974535 * Makefile.am (DEFS): Added. automake adds -I options to DEFS,
and we don't want that.
(INCLUDES): Removed all -I options except for the root source
directory and the root build directory.

* *.*: Change includes so that they always use the "prefixes"
libguile/, qt/, guile-readline/, or libltdl/.
(Thanks to Tim Mooney.)
2000-04-21 14:16:44 +00:00
Mikael Djurfeldt
bc9d9bb216 * gc.c (scm_must_malloc, scm_must_realloc, scm_must_free): Added
calls to malloc debugging functions.
2000-04-21 00:26:35 +00:00
Dirk Herrmann
195e620170 Some cleanups with regard to the use of SCM2PTR and casts to SCM_CELLPTR. 2000-04-19 16:47:11 +00:00
Dirk Herrmann
c8045e8dbd * struct.c, struct.h: Struct data regions (and thus also vtable data regions)
are now C arrays of scm_bits_t elements.
* gc.c:  Made the mixup of glocs and structs explicit.
2000-04-17 16:25:11 +00:00
Dirk Herrmann
cf551a2be9 The msymbol slots are now a field of scm_bits_t values. 2000-04-12 12:48:11 +00:00
Dirk Herrmann
54778cd312 Lots of fixes to make guile (at some time) compile with strict typing. 2000-04-03 08:47:51 +00:00
Dirk Herrmann
96f6f4aebf Removed use of SCM_POINTERS_MUNGED. 2000-03-25 07:56:53 +00:00
Mikael Djurfeldt
c67baafdd1 * gc.c (scm_mark_locations): Changed * (SCM **) X --> * (SCM *) X
in order to obtain a value of type SCM.
(scm_cellp): Updated with new changes to scm_mark_locations.
2000-03-23 13:04:27 +00:00
Mikael Djurfeldt
890b019c74 * gc.c (scm_gc_sweep): SCM_PACK/UNPACK corrections. 2000-03-22 02:12:24 +00:00
Mikael Djurfeldt
77490b49ab * gc.c (scm_gc_mark): Bugfix 1: The recent SCM_PACK/UNPACK change
made SCM values into pointers.  This turned an arithmetic
computation of the address of the vcell into a pointer-arithmetic
one, thereby screwing up marking of structs.
Bugfix 2: Removed incompletely introduced loop variable `j' used
when protecting the tail array of a struct.
2000-03-21 20:33:18 +00:00
Mikael Djurfeldt
8fef55a81c * gc.c, gc.h (SCM_MIN_YIELD_1, SCM_MIN_YIELD_2,
min_yield_fraction, min_yield, adjust_min_yield): Renamed from
SCM_GC_TRIGGER_1, SCM_GC_TRIGGER_2, gc_trigger_fraction,
gc_trigger, adjust_gc_trigger.

* gc.c (SCM_INIT_HEAP_SIZE_1, SCM_GC_TRIGGER_1, SCM_GC_TRIGGER_2):
Adjusted to 45000 cells, 40% and 40%.  Gives quick startup
without extra heap allocation.
2000-03-21 03:57:53 +00:00
Mikael Djurfeldt
1811ebcee5 * gc.c (alloc_some_heap): Further improvement of minimal heap size
prediction.
(SCM_MAX): New macro.
(scm_freelist_t): New field: collected_1. Previous amount of
collected cells.
(gc_sweep_freelist_finish): Trigger based on two last values of
freelist->collected to avoid unnecessary allocation due to
temporary peaks.
2000-03-21 02:37:59 +00:00
Mikael Djurfeldt
7dbff8b15d (gc_sweep_freelist_finish): Inserted explanation of use of
gc_trigger.
2000-03-20 15:05:33 +00:00
Mikael Djurfeldt
37ddcaf606 * gc.c (scm_gc_stats): Inserted explanation of local_scm_mtrigger
etc.
(scm_gc_yield_1): New variable: Holds previous yield.  Used to
make better judgements.
2000-03-20 14:57:04 +00:00
Mikael Djurfeldt
7febb4a206 * print.h, stacks.h, options.c, options.h: Changed C++
commentaries to C.
2000-03-20 14:39:23 +00:00
Mikael Djurfeldt
bda1446cd5 * gc.c (adjust_gc_trigger): Improved documentation.
(alloc_some_heap): Since gc_trigger is used against
freelist->collected, this is the value which should be used to
predict minimum growth.
2000-03-20 13:39:33 +00:00
Mikael Djurfeldt
8b0d194f91 * gc.c, gc.h (scm_gc_yield): New variable.
(adjust_gc_trigger): Use scm_gc_yield.
(alloc_some_heap): Use scm_gc_yield instead of
scm_gc_cells_collected.
2000-03-19 21:00:30 +00:00
Mikael Djurfeldt
b37fe1c56e * gc.c (scm_gc_for_newcell, adjust_gc_trigger): Improved GC
trigger adjustmeant: Take yield (freed cells) for all freelists
into account.
(SCM_INIT_HEAP_SIZE_1, SCM_GC_TRIGGER_1, SCM_GC_TRIGGER_2): Tuned
to 50000 cell heap with 45% trigger.
(scm_gc_cells_collected): Reintroduced.
(SCM_HEAP_SIZE): New macro.
(scm_gc_sweep): Reintroduced correct computation of
scm_cells_allocated.
(scm_freelist_t): Corrected commentary for field `cluster_size':
Clustersize counts objects, not cells;  New member
`clusters_allocated'.
2000-03-19 20:05:02 +00:00
Michael Livshin
89e00824a0 * *.[hc]: add Emacs magic at the end of file, to ensure GNU
indentation style.
2000-03-19 19:01:16 +00:00