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

47 commits

Author SHA1 Message Date
Ludovic Courtès
737219ddbb Add `scm_immutable_double_cell ()'.
* libguile/inline.h (scm_immutable_double_cell): New.
2008-09-16 12:10:52 +02:00
Ludovic Courtès
53ea4fdf99 Add `scm_immutable_cell ()'.
* libguile/inline.h (scm_immutable_cell): New.
2008-09-15 23:28:35 +02:00
Ludovic Courtès
6f03035fe8 Merge branch 'master' into boehm-demers-weiser-gc
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-10 23:09:30 +02:00
Ludovic Courtes
e7bca22779 Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header.
* libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'.

* libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/coop-threads.h: Likewise.

* libguile/coop.c: Likewise.

* libguile/gc.c: Likewise.
  (scm_storage_prehistory): Invoke `GC_init ()'.

* libguile/guardians.c: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/inline.h: Likewise.
  (scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'.

* libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of
  <gc/gc.h>.

* libguile/smob.c: Likewise.

* libguile/smob.h: Likewise.

* libguile/struct.c: Likewise.

* libguile/threads.c: Likewise.

* libguile/weaks.c: Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51
2008-09-10 22:19:49 +02:00
Han-Wen Nienhuys
7ddb9baf80 Cleanup mark-during-GC debug checks.
* libguile/__scm.h (SCM_DEBUG): add SCM_DEBUG_MARKING_API

* libguile/gc.h (SCM_SET_GC_MARK): depending on
SCM_DEBUG_MARKING_API crash if someone is touching markbits
outside regular hours.

Rename ensure_marking() to scm_i_ensure_marking().

* libguile/inline.h (scm_double_cell, scm_cell): only set mark bits
for debugging if SCM_DEBUG_MARKING_API is unset

* libguile/gc-mark.c: Issue deprecation warning if we are marking
outside of the GC mark phase.
2008-09-09 23:08:16 -03: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
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
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
Ludovic Courtès
f5c2af4be0 Inline scm_getc', scm_putc' and `scm_puts'. 2008-04-16 09:45:05 +02:00
Ludovic Courtès
9dca89355f Slightly simplify inline machinery. 2008-04-13 19:39:10 +02:00
Ludovic Courtès
07db6fcd4c Really fix inline machinery for MacOS X. 2008-04-13 19:39:03 +02:00
Ludovic Courtès
7dc9ae7179 Fix inline machinery in C99 mode on MacOS X. 2008-04-10 23:57:24 +02:00
Ludovic Courtès
979eade651 Fix inline machinery for GCC 4.3 and later in C99 mode. 2008-04-07 23:57:03 +02:00
Ludovic Courtès
3f52096714 Fix "mixed linkage" errors in `inline.h'. 2008-03-02 17:03:42 +00:00
Kevin Ryde
23f2b9a3de merge from 1.8 branch 2006-06-17 23:15:59 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
d5ad4aa6fa * inline.h, pairs.c (scm_is_pair): Moved scm_is_pair from pairs.c
to inline.h to make it inline.
2006-01-28 22:01:35 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Han-Wen Nienhuys
cb975c2105 (scm_double_cell): use __asm__ iso. asm, to maintain
compatibility with gcc -std=c99.
2005-03-28 11:40:58 +00:00
Marius Vollmer
94d375b5a7 (scm_cell, scm_double_cell): Do not check scm_gc_running_p, allocation
during sweeping is OK.
2005-03-10 18:08:12 +00:00
Marius Vollmer
b2a339f6e5 Updated comments for current threading implementation. 2005-03-09 19:14:36 +00:00
Marius Vollmer
bf6de59d5b Removed obsolete comment. 2005-03-02 20:11:55 +00:00
Marius Vollmer
76da80e788 Reverted changed from 2005/01/24 19:14:54, which was a commit to the
wrong branch.  Sorry.
2005-01-24 23:41:14 +00:00
Marius Vollmer
a54a94b397 Threading changes. 2005-01-24 19:14:54 +00:00
Marius Vollmer
9598a4060a * unif.h, unif.c, inline.h (scm_i_t_array_ref, scm_i_t_array_set):
New.
(scm_t_array_handle): Added ref, set, elements and
writable_elements for fast inline operation of
scm_array_handle_ref and scm_array_handle_set.
(scm_array_handle_ref, scm_array_handle_set): Moved to inline.h
and replaced with inline code that simply calls the ref/set
members of the handle.
(enclosed_ref, vector_ref, string_ref, bitvector_ref, memoize_ref,
enclosed_set, vector_set, string_set, bitvector_set, memoize_set):
New.
(scm_array_handle_get): Initialize ref/set fields to memoize_ref
and memoize_set.
(scm_bitvector_fill_x, scm_bitvector_to_list, scm_bit_count,
scm_bit_position, scm_bit_set_star_x, scm_bit_count_star,
scm_bit_invert_x): Correctly multiply index with increment in the
general case.

* unif.c (scm_array_handle_set): Correctly execute only one
alternative.  D'Oh!
(scm_list_to_typed_array, l2ra): Use scm_t_array_handle to fill
the array; this covers all cases with much simpler code.
2005-01-09 22:02:40 +00:00
Marius Vollmer
5e1e20c89c (scm_cell, scm_double_cell): Don't use C99 variable
declarations.
2004-11-02 22:47:36 +00:00
Han-Wen Nienhuys
497eb0b725 (scm_double_cell): abort if GC running.
(scm_cell): idem.
2004-10-07 22:52:22 +00:00
Marius Vollmer
d2e53ed6f8 *** empty log message *** 2004-09-22 17:41:37 +00:00
Marius Vollmer
050fedc4fd Fixed typo in comment. 2004-05-06 16:28:18 +00:00
Han-Wen Nienhuys
6b69393dcc (scm_cell): use SCM_GC_CELL_WORD for checking tag. 2004-04-06 21:49:43 +00:00
Marius Vollmer
2b2c6fca20 Use "extern inline" only with GCC. Use "static
inline" else.
2003-09-12 14:13:48 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Rob Browning
60e7529ae4 * inline.h: #include "libguile/__scm.h" at the top. Change code
to use SCM_C_INLINE and SCM_INLINE_C_INCLUDINT_INLINE_H to decide
what to do instead of creating a new public #define.  Rename usage
of USE_COOP_THREADS to SCM_USE_COOP_THREADS.  Rename usage of
USE_NULL_THREADS to SCM_USE_NULL_THREADS.  Rename usage of
USE_COPT_THREADS to SCM_USE_COPT_THREADS.

* inline.c: rearrange handling -- now we just #define
SCM_INLINE_C_INCLUDING_INLINE_H to 1 and #include
"libguile/inline.h".  scmconfig.h will define SCM_C_INLINE as
appropriate, and we use that in inline.h along with the above
define to determine how to respond.
2003-03-25 23:56:55 +00:00
Mikael Djurfeldt
9bc4701cd3 * __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(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-12-09 13:42:58 +00:00
Marius Vollmer
3d7f708f21 * __scm.h (USE_THREADS, GUILE_ISELECT): Define when
SCM_DEBUG_DEPRECATED.  Removed their use thru-out Guile.
2002-11-03 22:09:20 +00:00
Marius Vollmer
b1e945d7ec (scm_cell, scm_double_cell): Also allow USE_COPT_THREADS to not
protect the slot initializers.
2002-10-27 20:13:00 +00:00
Marius Vollmer
389626c5ec (scm_cell, scm_double_cell): Also allow USE_NULL_THREADS to not
protect the slot initializers.
2002-10-16 16:03:44 +00:00
Gary Houston
3553e1d1f0 * inline.h (scm_double_cell): prevent reordering of statements
with any following code (for GCC 3 strict-aliasing).
	* numbers.c (scm_make_real), num2float.i.c (FLOAT2NUM): removed
	the earlier version of the reordering prevention.
2002-09-24 22:21:01 +00:00
Han-Wen Nienhuys
4ad0814a57 (scm_double_cell): move SET_GCMARK set out of if body. 2002-09-19 11:14:46 +00:00
Han-Wen Nienhuys
1e71eafb34 * inline.h: include stdio.h
* smob.c (free_print): abort if scm_debug_cell_accesses_p is set
2002-09-08 11:31:32 +00:00
Han-Wen Nienhuys
eab1b25970 * gc.h: add scm_debug_cells_gc_interval to public interface
* gc-card.c ("sweep_card"): set scm_gc_running while sweeping.

* gc.c (scm_i_expensive_validation_check): separate expensive
validation checks from cheap ones.
2002-08-08 19:47:31 +00:00
Han-Wen Nienhuys
c8a1bdc460 new gc 2002-08-04 00:17:18 +00:00
Dirk Herrmann
228a24ef30 Changes in doc/ref:
* api.txt, data-rep.texi: Renamed the struct scm_cell to
scm_t_cell.

* data-rep.texi: Renamed scm_alloc_cell to scm_cell and
scm_alloc_double_cell to scm_double_cell.

Changes in libguile:

* gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL,
init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct
scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE,
SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP):  Renamed the struct
scm_cell and all its uses to scm_t_cell in accordance to Guile's
naming scheme for types.

* alist.c (scm_acons), convert.i.c (CTYPES2UVECT,
CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread,
scm_spawn_thread), debug.c (scm_make_debugobj), environments.c
(scm_make_environment), eval.c (scm_closure), fports.c
(scm_fdes_to_port), gc.c (scm_deprecated_newcell,
scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell),
list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons),
ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo),
smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c
(scm_take_str, scm_allocate_string), strports.c (scm_mkstrport),
unif.c (scm_make_uve), variable.c (make_variable), vectors.c
(scm_c_make_vector), vports.c (scm_make_soft_port): Renamed
scm_alloc_cell to scm_cell.

* environments.c (core_environments_observe), gc.c
(scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object),
inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c
(FLOAT2NUM), numbers.c (scm_make_real), procs.c
(scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2,
SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable),
symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c
(allocate_weak_vector): Renamed scm_alloc_double_cell to
scm_double_cell.
2002-03-01 00:19:20 +00:00
Dirk Herrmann
1fc8902f02 * gc.h (SCM_GC_CELL_WORD, SCM_GC_CELL_OBJECT,
SCM_GC_SET_CELL_WORD, SCM_GC_SET_CELL_OBJECT):  New macros.

(SCM_GC_CELL_TYPE, SCM_CELL_WORD, SCM_CELL_OBJECT,
SCM_SET_CELL_WORD, SCM_SET_CELL_OBJECT, SCM_FREE_CELL_CDR,
SCM_GC_SET_CELL_OBJECT):  Express in terms of SCM_GC_CELL_*
macros.

(SCM_FREE_CELL_P):  Express in terms of SCM_GC_CELL_TYPE.

* inline.h (scm_alloc_cell, scm_alloc_double_cell):  Use
SCM_GC_CELL_* macros when accessing free cells.
2001-11-27 23:18:16 +00:00
Marius Vollmer
6253f3f1d9 Added prototypes for defined functions for the !HAVE_INLINE case. 2001-11-25 15:02:44 +00:00
Marius Vollmer
16ea96206d New files. 2001-11-25 14:45:17 +00:00