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

178 commits

Author SHA1 Message Date
Marius Vollmer
92c2555f69 replace "scm_*_t" with "scm_t_*". 2001-06-14 19:50:43 +00:00
Michael Livshin
6b1b030e4d * gc.c (scm_init_storage): init `scm_gc_registered_roots'.
(scm_igc): mark from them, too (precisely, not conservatively!).

* root.h (scm_gc_registered_roots): new object in
scm_sys_protects.

* hooks.c (scm_create_hook): call `scm_gc_protect_object' instead
`scm_protect_object'.  shouldn't call it at all, though, it seems.

* gc.c (scm_[un]protect_object): deprecated.
(scm_gc_[un]protect_object): new names for scm_[un]protect_object.
(scm_gc_[un]register_root[s]): new.

* gc.h: add prototypes for scm_gc_[un]protect_object,
scm_gc_[un]register_root[s].
2001-05-26 22:10:58 +00:00
Michael Livshin
c014a02eec revert the ill-considered part of the 2001-05-24 changes 2001-05-26 20:51:22 +00:00
Michael Livshin
1be6b49ccb * validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.

* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.

* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.

* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.

* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.

* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.

* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.

* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.

* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.

* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t

* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.

* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.

* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.

* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x

* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.

* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.

* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.

* gsubr.c: various int -> scm_bits_t changes.

* gh_data.c (gh_scm2double): no loss of precision any more.

* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.

* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.

* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t

* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.

* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t

* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t

* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.

* extensions.c: extension -> extension_t (and made a typedef).

* eval.h (SCM_IFRAME): cast to scm_bits_t, not int.  just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.

* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t

* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t

* dynwind.c (scm_dowinds): delta: long -> scm_bits_t

* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t

* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.

* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t

* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.

* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.

* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.

* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
Marius Vollmer
e4a7824f4e * gc.h, gc.c (scm_must_strdup, scm_must_strndup): New. 2001-05-20 19:27:22 +00:00
Dirk Herrmann
7c33806ae6 * Make SCM_DEBUG_CELL_ACCESSES=1 work with GUILE_DEBUG_FREELIST. 2001-05-15 09:45:10 +00:00
Dirk Herrmann
e038c04203 * Eliminate some further applications of SCM_C[AD]R to non pair cells. 2001-04-19 09:38:37 +00:00
Dirk Herrmann
6104519023 * Made SCM_DEBUG_CELL_ACCESSES working again. 2001-03-30 17:01:28 +00:00
Michael Livshin
322ec19d3c * objects.h (SCM_SET_ENTITY_SETTER): new macro. SCM_ENTITY_SETTER
casts its result, so doesn't yield an lvalue per ANSI C.

* goops.c (s_scm_sys_set_object_setter_x): use
SCM_SET_ENTITY_SETTER.
(clear_method_cache): use SCM_SET_ENTITY_PROCEDURE.

* gc.h (SCM_GC_SET_CARD_BVEC): new macro.  SCM_GC_CARD_BVEC casts
its result, so doesn't yield an lvalue per ANSI C.
(SCM_GC_SET_CARD_FLAGS): ditto for SCM_GC_GET_CARD_FLAGS.
(SCM_GC_CLR_CARD_FLAGS): redefined in terms of
SCM_GC_SET_CARD_FLAGS.
(SCM_GC_SET_CARD_FLAG, SCM_GC_CLR_CARD_FLAGS): ditto.

* gc.c (INIT_CARD): use the explicit setter macro to set the bvec.
2001-01-11 21:03:18 +00:00
Dirk Herrmann
5d2b97cd07 * Fixed the changelog entry regarding re-introduction of struct member
properties (I continuously talked of member 'documentation' instead)
* Replace calls to scm_remember with calls to scm_remember_upto_here_1.
2000-12-28 16:49:09 +00:00
Michael Livshin
56495472c2 * gc.c: (scm_gc_mark_dependencies): new function. like
`scm_gc_mark', but doesn't mark the argument itself.  defined
using an arrangement similar to that in eval.c: `scm_gc_mark' and
`scm_gc_mark_dependencies' are derived from the same "template"
by ugly preprocessor magic.

* gc.h: added prototype for `scm_gc_mark_dependencies'.

* init.c (scm_init_guile_1): call the renamed
`scm_init_guardians'.

* guardians.h: changed prototypes for `scm_make_guardian' and
`scm_init_guardians'.

* guardians.c (guardian_t): added new fields `greedy_p' and
`listed_p'.
(GUARDIAN_P): predicate that says whether its argument is a
guardian.
(GUARDIAN_GREEDY_P, GUARDIAN_LISTED_P): new predicates.
(greedy_guardians, sharing_guardians): new variables.  hold the
greedy and sharing live guardian lists, respectively.
(first_live_guardian, current_link_field): removed.
(greedily_guarded_prop): new variable.  holds the "is greedily
guarded" object property.
(self_centered_zombies): new variable.  stores guarded objects
that are parts of cycles.
(add_to_live_list): new function, introduced to decouple marking a
guardian and adding it to the live list.
(guardian_mark): call `add_to_live_list'.
(guardian_print): print whether the guardian is greedy or not.
also change "live" and "zombie" to "reachable" and "unreachable"
respectively, to be less confusing.
(scm_guard): if the guardian is greedy, test whether the object is
already greedily marked.  throw an error if so.
(scm_get_one_zombie): if the guardian is greedy, remove the
"greedily guarded" property from the object.
(scm_make_guardian): add a new optional boolean argument which
says whether the guardian is greedy or sharing.
(guardian_gc_init): init the new live lists.
(mark_dependencies): new function.
(mark_and_zombify): new function.
(guardian_zombify): reworked to support the new guardian
semantics.  move some logic to `mark_dependencies' and
`mark_and_zombify'.
(whine_about_self_centered_zombies): new function.  installed in
the `after-gc-hook' to complain about guarded objects which are
parts of cycles.
(scm_init_guardians): init the new stuff.  renamed from
`scm_init_guardian'.
2000-12-23 23:00:23 +00:00
Dirk Herrmann
85db4a2c8e * Initialize symbols using SCM_(GLOBAL_)?SYMBOL instead of scm_sysintern...
* Use scm_str2symbol instead of scm_sysintern0.
* Garbage collection initialization code now within gc.c only.
2000-12-11 14:48:23 +00:00
Dirk Herrmann
fd3363659b * eval.c: remove commented code, remove #ifdef CCLO conditionals
* remove uses of older GC marking and cell accessing macros
2000-12-06 15:16:59 +00:00
Dirk Herrmann
d1ca2c6423 * Some more work to get rid of SCM_LENGTH
* Eliminated some cell type bit fiddling
* Various minor changes
2000-10-25 11:01:03 +00:00
Marius Vollmer
9208204554 * gc.h (scm_get_stack_base): Added prototype. 2000-10-11 19:20:14 +00:00
Michael Livshin
3c8018e61e * gc.h: removed now-obsolete comments about the `allocated' cell
state.
(SCM_NEWCELL): don't change cell type to `allocated'.
(SCM_NEWCELL2): ditto.
2000-09-02 21:53:02 +00:00
Michael Livshin
f91f77e64e * gc.h (SCM_GC_CARD_N_CELLS): change to be a nice non-confusing
constant.
2000-08-21 10:06:45 +00:00
Michael Livshin
35e9b48d79 * gc.h: removed some stuff that broke compilation for people and
wasn't actually needed anyway.
2000-08-18 22:33:37 +00:00
Michael Livshin
e618c9a3c8 * gc.h (SCM_MARKEDP): simplified, there are no different mark bit
locations anymore.
(SCM_GC_CARD_*, SCM_C_BVEC_*): lots of new macros to deal with
cards and bvecs (bit-vectors).
2000-08-17 20:38:23 +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
Dirk Herrmann
78a3503e56 * Fixed some type-related errors. 2000-07-18 16:59:35 +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
3f5d82cd9a * Use a set of dedicated macros to access and modify free cells. 2000-07-10 14:25:53 +00:00
Dirk Herrmann
f706a58b67 * Make the compiler warn about code like SCM_CELL_WORD (x, n) = y. 2000-07-10 13:54:03 +00:00
Mikael Djurfeldt
076d6063fa * gc.h, tags.h: Be kind to compilers which must see hash signs in
column 0.  (Thanks to Ian Grant.)
2000-06-20 14:57:55 +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
708cb87c6e * gc.h (SCM_VALIDATE_CELL): Rewritten.
(SCM_CELL_WORD, SCM_CELL_OBJECT, SCM_SET_CELL_WORD,
SCM_SET_CELL_OBJECT): Use new version of SCM_VALIDATE_CELL.
(Thanks to Han-Wen Nienhuys.)
2000-06-11 19:50:09 +00:00
Dirk Herrmann
4b479d9818 * gh.h: Don't take the address of a SCM value.
* sort.c: Don't take the address of SCM_CAR, use SCM_CARLOC instead.
2000-06-05 12:09:35 +00:00
Mikael Djurfeldt
05a85bae79 * gc.h (SCM_VALIDATE_CELL): Cast result to (void) in order to
avoid compiler warnings in gcc.  (Does this work for other
compilers?)
2000-06-03 00:17:31 +00:00
Mikael Djurfeldt
217883aa45 * gc.h (SCM_VALIDATE_CELL): Don't "use" the value returned by
abort ().
(SCM_CARLOC, SCM_CDRLOC): Define directly instead of using
SCM_CELL_OBJECT_0 and SCM_CELL_OBJECT_1.  It's not correct to take
the address of these expressions since they use SCM_VALIDATE_CELL.
(Thanks to Bernard Urban.)
2000-06-02 23:47:11 +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
a564e775fc * guile-doc-snarf.in: put the preprocessed file through sed to
trim all lines to 512 chars.  I hope it doesn't break anybody's
shell.  we'll see.

* gc.h (SCM_[SET_]CELL_{WORD,OBJECT}, SCM_VALIDATE_CELL): reverted
the previous change to this macros, after deciding to torture the
snarfer instead.
2000-05-22 14:03:37 +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
46d53380a2 * Added SCM_DEBUG_CELL_ACCESSES debug option. 2000-05-19 15:46:32 +00:00
Dirk Herrmann
5610071627 * Makefile.am: Let 'make clean' remove *.x and *.doc files.
* Renamed SCM_STRICT_TYPING to SCM_DEBUG_TYPING_STRICTNESS.
* Removed conditionally compiled code for Turbo C.
* gdbint.c:  Eliminated call to scm_tag.
2000-05-16 12:11:08 +00:00
Dirk Herrmann
e828cb75d4 * Scheme cells now consist of scm_bits_t values instead of SCM values.
* Use SCM_SETC[AD]R to modify contents of pairs.
2000-05-10 14:04:48 +00:00
Mikael Djurfeldt
9b3e180c0d * gc.h: Added #include "libguile/hooks.h". 2000-04-21 23:11:51 +00:00
Dirk Herrmann
2d67e39007 Use SCM_{SET_}?CELL_TYPE when accessing the type entry of a cell. 2000-03-27 22:43:37 +00:00
Dirk Herrmann
2549a7096d Moved some cell related definitions from tags.h and pairs.h to gc.h. 2000-03-26 10:08:52 +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
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
Michael Livshin
a00c95d9c6 * tags.h: (SCM_DOUBLE_CELLP, SCM_NDOUBLE_CELLP): new macros.
* gc.h: (typedef struct scm_freelist_t) remove from here.

* gc.c: (CELL_UP, CELL_DN) make these macros take additional
parameter (the span).
(CLUSTER_SIZE_IN_BYTES, ALIGNMENT_SLACK) new macros.
(typedef struct scm_freelist_t) move here from gc.h, it had no
business being externally visible.
(typedef struct scm_heap_seg_data_t) renamed from
scm_heap_seg_data, to be style-compliant.
(scm_mark_locations) if the possible pointer points to a
multy-cell, check that it's properly aligned.
(init_heap_seg) alighn multy-cells properly, work with the
assumption that the segment size divides cleanly by cluster size
(so that there's no spill).
(round_to_cluster_size) new function.
(alloc_some_heap, make_initial_segment) use round_to_cluster_size
to satisfy the new init_heap_seg invariant.
2000-03-18 11:09:41 +00:00
Mikael Djurfeldt
4c48ba0605 * gc.c, gc.h: Cleanup of the change of 2000-03-15.
Cluster sizes are now independent of GC trigger values.
GUILE_GC_TRIGGER_n can now specify a relative trigger value:
A negative integer gives fraction of total heap size in percent.
2000-03-17 08:09:14 +00:00
Mikael Djurfeldt
5384bc5b52 * gc.c, gc.h (scm_map_free_list): Define also if GUILE_DEBUG is
defined.
(scm_free_list_length): New procedure (GUILE_DEBUG).
2000-03-16 03:59:35 +00:00
Mikael Djurfeldt
bb2c57fa98 * gc.c, gc.h (scm_map_free_list): Define also if GUILE_DEBUG is
defined.
2000-03-16 01:29:00 +00:00
Mikael Djurfeldt
dd45c0dfdb Removed some stupid code. 2000-03-15 15:19:50 +00:00
Mikael Djurfeldt
4a4c9785e0 * gc.c, gc.h, pairs.h, init.c: Implementation of a new way of
allocating heap.  The basic idea is to trigger GC every Nth
allocated cell and grow heap when free list runs out.  The scheme
has been extended so that GC isn't triggered until all remaining
cells are used.  The implementation is also prepared for
development in the direction of POSIX threads.

* gc.c (SCM_EXPHEAP): In order to grow by a factor of 1.5,
SCM_EXPHEAP should return half of the heap size.
2000-03-15 07:30:53 +00:00
Mikael Djurfeldt
bb6df2eec3 * gc.h (scm_freelist_t): New type. 2000-03-14 09:03:08 +00:00
Mikael Djurfeldt
16d35552c4 *** empty log message *** 2000-03-14 06:43:57 +00:00