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

189 commits

Author SHA1 Message Date
Morgan Smith
f27e8b855f
Fix typos throughout codebase.
* NEWS:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-deprecated.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-foreign.texi:
* doc/ref/api-i18n.texi:
* doc/ref/api-io.texi:
* doc/ref/api-languages.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-memory.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-options.texi:
* doc/ref/api-peg.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/expect.texi:
* doc/ref/goops.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/repl-modules.texi:
* doc/ref/scheme-ideas.texi:
* doc/ref/scheme-scripts.texi:
* doc/ref/srfi-modules.texi:
* gc-benchmarks/larceny/dynamic.sch:
* gc-benchmarks/larceny/twobit-input-long.sch:
* gc-benchmarks/larceny/twobit.sch:
* libguile/gc.h:
* libguile/ioext.c:
* libguile/list.c:
* libguile/options.c:
* libguile/posix.c:
* libguile/threads.c:
* module/ice-9/boot-9.scm:
* module/ice-9/optargs.scm:
* module/ice-9/ports.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/psyntax.scm:
* module/language/elisp/parser.scm:
* module/language/tree-il/compile-bytecode.scm:
* module/srfi/srfi-37.scm:
* module/srfi/srfi-43.scm:
* module/statprof.scm:
* module/texinfo/reflection.scm:
* test-suite/tests/eval.test:
* test-suite/tests/fluids.test:
Fix typos.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06 11:51:53 +02:00
Andy Wingo
16879cabed Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint types
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/bytevectors.c:
* libguile/bytevectors.h:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/conv-uinteger.i.c:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/hash.c:
* libguile/i18n.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/pairs.c:
* libguile/ports-internal.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/print.c:
* libguile/print.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/random.h:
* libguile/scm.h:
* libguile/socket.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/uniform.c:
* libguile/vm-engine.c:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* test-suite/standalone/test-conversion.c:
* test-suite/standalone/test-ffi-lib.c:
* test-suite/standalone/test-scm-take-u8vector.c:
* test-suite/standalone/test-srfi-4.c: Replace e.g. scm_t_uint8 with
  uint8_t.
2018-06-21 20:18:54 +02:00
Andy Wingo
1234bb1850 Update license notices in all C files
Update to newest recommended license notices from the FSF.  Everything
stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20 20:07:34 +02:00
Andy Wingo
791eb0c01a Remove (C) from copyright statements
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.'  It does take up
space though!  For that reason, we remove it here from our C files.
2018-06-20 19:17:06 +02:00
Andy Wingo
97cc65fee4 Rename __scm.h to scm.h
* libguile/scm.h: Rename.  Update all includers.
2018-06-20 16:33:33 +02:00
Andy Wingo
c495b44714 Remove Emacs local variables comments in Guile source
The .dir-locals.el file in the repository is sufficient for Emacs
users.

* libguile/__scm.h:
* libguile/alist.c:
* libguile/alist.h:
* libguile/array-handle.c:
* libguile/array-handle.h:
* libguile/array-map.c:
* libguile/array-map.h:
* libguile/arrays.c:
* libguile/arrays.h:
* libguile/async.c:
* libguile/async.h:
* libguile/backtrace.c:
* libguile/backtrace.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/boolean.c:
* libguile/boolean.h:
* libguile/chars.c:
* libguile/chars.h:
* libguile/chooks.c:
* libguile/chooks.h:
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/debug-malloc.h:
* libguile/debug.c:
* libguile/debug.h:
* libguile/deprecation.c:
* libguile/deprecation.h:
* libguile/dynl.c:
* libguile/dynl.h:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/dynwind.h:
* libguile/eq.c:
* libguile/eq.h:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/eval.h:
* libguile/evalext.c:
* libguile/evalext.h:
* libguile/expand.c:
* libguile/expand.h:
* libguile/extensions.c:
* libguile/extensions.h:
* libguile/feature.c:
* libguile/feature.h:
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.c:
* libguile/gc.h:
* libguile/generalized-arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/gettext.c:
* libguile/gettext.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/guardians.c:
* libguile/guardians.h:
* libguile/guile.c:
* libguile/hash.c:
* libguile/hash.h:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/hooks.h:
* libguile/i18n.c:
* libguile/i18n.h:
* libguile/init.c:
* libguile/init.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/ioext.c:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.c:
* libguile/keywords.h:
* libguile/list.c:
* libguile/list.h:
* libguile/load.c:
* libguile/load.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/macros.c:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memmove.c:
* libguile/memoize.c:
* libguile/memoize.h:
* libguile/modules.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/net_db.h:
* libguile/null-threads.c:
* libguile/null-threads.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/objprop.c:
* libguile/objprop.h:
* libguile/options.c:
* libguile/options.h:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/poll.c:
* libguile/poll.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/posix.h:
* libguile/print.c:
* libguile/print.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/procs.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/promises.c:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.c:
* libguile/random.h:
* libguile/rdelim.c:
* libguile/rdelim.h:
* libguile/read.c:
* libguile/read.h:
* libguile/regex-posix.c:
* libguile/regex-posix.h:
* libguile/rw.c:
* libguile/rw.h:
* libguile/scmsigs.c:
* libguile/scmsigs.h:
* libguile/script.c:
* libguile/script.h:
* libguile/simpos.c:
* libguile/simpos.h:
* libguile/smob.c:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.c:
* libguile/socket.h:
* libguile/sort.c:
* libguile/sort.h:
* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/stackchk.c:
* libguile/stackchk.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/stime.c:
* libguile/stime.h:
* libguile/strerror.c:
* libguile/strings.c:
* libguile/strings.h:
* libguile/strorder.c:
* libguile/strorder.h:
* libguile/strports.c:
* libguile/strports.h:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/symbols.h:
* libguile/syntax.c:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.c:
* libguile/unicode.h:
* libguile/uniform.c:
* libguile/uniform.h:
* libguile/values.c:
* libguile/values.h:
* libguile/variable.c:
* libguile/variable.h:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/version.c:
* libguile/vm-engine.c:
* libguile/vm-expand.h:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove needless trailing comments.
2018-06-20 14:32:28 +02:00
Andy Wingo
5534c2817e Remove useless "classes: h_files" from Guile headers.
* libguile/__scm.h:
* libguile/alist.h:
* libguile/array-handle.h:
* libguile/array-map.h:
* libguile/arrays.h:
* libguile/async.h:
* libguile/backtrace.h:
* libguile/bitvectors.h:
* libguile/boolean.h:
* libguile/chars.h:
* libguile/chooks.h:
* libguile/continuations.h:
* libguile/debug-malloc.h:
* libguile/debug.h:
* libguile/deprecation.h:
* libguile/dynl.h:
* libguile/dynstack.h:
* libguile/dynwind.h:
* libguile/eq.h:
* libguile/error.h:
* libguile/eval.h:
* libguile/evalext.h:
* libguile/expand.h:
* libguile/extensions.h:
* libguile/feature.h:
* libguile/filesys.h:
* libguile/fluids.h:
* libguile/fports.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.h:
* libguile/gettext.h:
* libguile/goops.h:
* libguile/gsubr.h:
* libguile/guardians.h:
* libguile/hash.h:
* libguile/hashtab.h:
* libguile/hooks.h:
* libguile/i18n.h:
* libguile/init.h:
* libguile/inline.h:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.h:
* libguile/list.h:
* libguile/load.h:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memoize.h:
* libguile/modules.h:
* libguile/net_db.h:
* libguile/null-threads.h:
* libguile/numbers.h:
* libguile/objprop.h:
* libguile/options.h:
* libguile/pairs.h:
* libguile/poll.h:
* libguile/ports.h:
* libguile/posix-w32.h:
* libguile/posix.h:
* libguile/print.h:
* libguile/procprop.h:
* libguile/procs.h:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.h:
* libguile/rdelim.h:
* libguile/read.h:
* libguile/regex-posix.h:
* libguile/rw.h:
* libguile/scmsigs.h:
* libguile/script.h:
* libguile/simpos.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.h:
* libguile/sort.h:
* libguile/srcprop.h:
* libguile/stackchk.h:
* libguile/stacks.h:
* libguile/stime.h:
* libguile/strings.h:
* libguile/strorder.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.h:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.h:
* libguile/uniform.h:
* libguile/values.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.h:
* libguile/weak-table.h:
* libguile/weak-vector.h: Remove "classes: h_files".  Reformat
  copyrights if needed.
2018-06-20 14:26:16 +02:00
Andy Wingo
d340a9709c Shuffle around inline C function implementation
* libguile/__scm.h:
* libguile/inline.h (SCM_C_EXTERN_INLINE, SCM_CAN_INLINE, SCM_INLINE)
  (SCM_INLINE_IMPLEMENTATION): Move definitions here, from __scm.h.
* libguile/strings.h (scm_is_string): Move implementation here, from
  inline.h.
* libguile/inline.c: Add strings.h include.
* libguile/_scm.h: Remove inline.h include.
* libguile/array-handle.h:
* libguile/gc.h:
* libguile/pairs.h:
* libguile/smob.h: Add inline.h includes.
2018-06-20 11:17:13 +02:00
Andy Wingo
6f294ecc75 Devolve more validate macros
* libguile.h: Add chooks.h.
* libguile/Makefile.am: Add chooks.h and chooks.c.
* libguile/chooks.c:
* libguile/chooks.h: New files, for the C implementation of hooks.
  Broken out to avoid cycles in gc.h includes.
* libguile/gc.h:
* libguile/gc.c (scm_i_gc_admin_mutex, scm_i_sweep_mutex): Remove unused
  mutexes.  Include chooks instead of hooks in the main header.
* libguile/deprecated.h (scm_gc_running_p): Deprecate this macro always
  defined to 0.
  (SCM_VALIDATE_VECTOR_OR_DVECTOR): Deprecate this weird one too.
* libguile/array-map.c: Add procs.h include.
* libguile/threads.h:
* libguile/vm.c:
* libguile/r6rs-ports.c: Add smob.h include.
* libguile/atomic.h (SCM_VALIDATE_ATOMIC_BOX): Devolve.
* libguile/deprecation.c (scm_c_issue_deprecation_warning): Remove use
  of scm_gc_running_p.
* libguile/error.c (scm_error_scm): Remove use of scm_gc_running_p.
* libguile/filesys.h (SCM_VALIDATE_DIR)
* libguile/fluids.h (SCM_VALIDATE_FLUID)
* libguile/fports.h (SCM_VALIDATE_FPORT, SCM_VALIDATE_OPFPORT)
* libguile/generalized-arrays.h (SCM_VALIDATE_ARRAY)
* libguile/hooks.h (SCM_VALIDATE_HOOK)
* libguile/keywords.h (SCM_VALIDATE_KEYWORD)
* libguile/ports.h (SCM_VALIDATE_PORT, SCM_VALIDATE_INPUT_PORT)
  (SCM_VALIDATE_OUTPUT_PORT, SCM_VALIDATE_OPINPORT)
  (SCM_VALIDATE_OPENPORT, SCM_VALIDATE_OPPORT, SCM_VALIDATE_OPOUTPORT)
* libguile/procs.h (SCM_VALIDATE_PROC)
* libguile/random.h (SCM_VALIDATE_RSTATE)
* libguile/regex-posix.h (SCM_VALIDATE_RGXP)
* libguile/stacks.h (SCM_VALIDATE_STACK, SCM_VALIDATE_FRAME)
* libguile/strports.h (SCM_VALIDATE_OPOUTSTRPORT)
* libguile/struct.h (SCM_VALIDATE_STRUCT SCM_VALIDATE_VTABLE)
* libguile/symbols.h (SCM_VALIDATE_SYMBOL)
* libguile/variable.h (SCM_VALIDATE_VARIABLE)
* libguile/vectors.h (SCM_VALIDATE_VECTOR SCM_VALIDATE_VECTOR_LEN):
  Devolve.
* libguile/validate.h: It's empty now!

hooks squish
2018-06-18 10:50:17 +02:00
Andy Wingo
f84ce5442e Refactor handling of auxiliary stacks and setjmp/longjmp
* libguile/__scm.h (scm_i_jmp_buf): Remove definition, which was a shim
  for ia64.  Instead, always use setjmp/longjmp and jmp_buf.
* libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Remove; instead use
  setjmp and longjmp.
* libguile/continuations.c (capture_auxiliary_stack):
  (restore_auxiliary_stack): New helpers.
  (scm_i_make_continuation): Use capture_auxiliary_stack.
  (copy_stack_and_call): Use restore_auxiliary_stack.  No need to stash
  the aux stack on the thread, either.
* libguile/continuations.h (scm_t_contregs): Use
  SCM_HAVE_AUXILIARY_STACK to flag when to have an auxiliary_stack
  member.
* libguile/control.h:
* libguile/control.c (reify_partial_continuation, scm_c_abort):
  (scm_suspendable_continuation_p): Adapt to use setjmp/longjmp
  directly.
* libguile/deprecated.h: Add deprecated scm_i_jmp_buf define.
* libguile/dynstack.h:
* libguile/dynstack.c (PROMPT_JMPBUF):
  (scm_dynstack_push_prompt, scm_dynstack_find_prompt):
  (scm_dynstack_wind_prompt): Adapt to jmp_buf type.
* libguile/eval.c (eval): Use jmp_buf and setjmp directly.
* libguile/gc-malloc.c: No need for ia64-specific things.
* libguile/gc.c: No need for ia64-specific things.
* libguile/gc.h: No need to declare scm_ia64_ar_bsp.
* libguile/init.c: Remove typedef of setjmp_type for Cray, unused.
* libguile/threads.c (guilify_self_1): No more pending_rbs_continuation
  in scm_i_thread, and register_backing_store_base is handled by libgc.
  (scm_ia64_ar_bsp): Remove definitions; inlined into continuations.c's
  capture_auxiliary_stack.
* libguile/threads.h (scm_i_thread): jmpbuf member is plain jmp_buf.
* libguile/throw.c (catch): Just use jmp_buf and setjmp.
* libguile/vm-engine.c (VM_NAME): Adapt prototype to take jmp_buf
  pointer.
* libguile/vm.c (vm_abort): Adapt jmp_buf types.
  (scm_call_n): Use setjmp.
2018-06-17 13:41:03 +02:00
Andy Wingo
b2515e65bd Remove unused getters for register backing store base
* libguile/gc.h:
* libguile/threads.c: Remove unused implementations of
  scm_ia64_register_backing_store_base, as libgc does this for us.
2018-06-17 13:41:03 +02:00
Andy Wingo
705e3a83c8 Remove SCM_DEBUG_CELL_ACCESSES==1
Since the move to BDW-GC this option has not been useful.

* libguile/__scm.h (SCM_DEBUG_CELL_ACCESSES): Remove default
  definition.
* libguile/gc.h: Add comment about cells.
  (SCM_VALIDATE_CELL): Remove.  I did a search on the internet and I
  found no external users.
  (SCM_CELL_WORD, SCM_CELL_OBJECT, SCM_SET_CELL_WORD)
  (SCM_SET_CELL_OBJECT, SCM_CELL_OBJECT_LOC): Remove SCM_VALIDATE_CELL
  uses.
* libguile/gc.c (scm_debug_cell_accesses_p)
  (scm_expensive_debug_cell_accesses_p)
  (scm_debug_cells_gc_interval, scm_i_expensive_validation_check)
  (scm_assert_cell_valid): Remove bindings only available when
  SCM_DEBUG_CELL_ACCESSES was 1.
* libguile/list.c (scm_list_n): Remove SCM_VALIDATE_CELL usage.
2016-11-18 21:18:23 +01:00
Andy Wingo
c2247b782a Out-of-memory situations raise exceptions instead of aborting
* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory
  handler that raises an unwind-only out-of-memory exception.
  (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to
  print to the current warning port, if the current warning port is a
  file port.
  (scm_gc_after_nonlocal_exit): New interface.  Should be called after a
  nonlocal return to potentially collect memory; otherwise allocations
  could try to expand again when they should collect.

* libguile/continuations.c (scm_i_make_continuation):
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after
  nonlocal returns.

* libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework
  to avoid allocating memory.
  (scm_report_out_of_memory): New interface.
  (scm_init_throw): Pre-allocate the arguments for stack-overflow and
  out-of-memory errors.

* module/ice-9/boot-9.scm: Add an out-of-memory exception printer.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
  out-of-memory to the report-keys set.

* libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if
  realloc fails.

* libguile/error.h:
* libguile/error.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_memory_error): Deprecate.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-out-of-memory: New test case.
2014-03-22 15:49:31 +01:00
Andy Wingo
fcd953f699 Merge commit 'd364a89718'
Conflicts:
	libguile/deprecated.h
	libguile/gc.c
2013-11-28 16:16:48 +01:00
Andy Wingo
d364a89718 Deprecate gc-live-object-stats
* libguile/gc.h:
* libguile/gc.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't
  worked in the whole 2.0 series.
2013-11-28 14:40:58 +01:00
Mark H Weaver
f6f4feb0a2 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/array-map.c
	libguile/fports.h
	libguile/gc.h
	libguile/inline.h
	libguile/ports.c
	libguile/ports.h
	libguile/print.c
	libguile/r6rs-ports.c
	libguile/read.c
	test-suite/tests/00-socket.test
2013-04-14 02:48:33 -04:00
Mark H Weaver
663780bb1c Add 'scm_gc_typed_calloc' macro.
* libguile/gc.h (scm_gc_typed_calloc): New macro.
2013-04-01 16:09:57 -04:00
Andy Wingo
42d691ee16 scm_cell, scm_double_cell, scm_words back to gc.h
* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
  declarations and definitions back here, from inline.h.  It's more
  natural.

* libguile/inline.c: Include gc.h as well.
2012-03-08 12:40:27 +01:00
Andy Wingo
46163e52e5 simplify inline function infrastructure
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
  from inline.h.  We'd like to support inline function definitions in
  more header files: not just inline.h.
  (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
  definitions.

* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
  wrappers, which redirect to the GC_MALLOC macros when building Guile,
  and the scm_gc_malloc functions otherwise.  A step towards getting
  BDW-GC out of Guile's API.

* libguile/inline.h: Simplify, using SCM_INLINE,
  SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES.  Also use the
  new SCM_GC_MALLOC macros.
2012-03-08 12:40:27 +01:00
Ludovic Courtès
c336514976 Change `scm_words' to accept a 32-bit word number.
Fixes <http://bugs.gnu.org/10914>.
Reported by Tobias Brandt <tob.brandt@googlemail.com>.

* libguile/gc.h (scm_words): Change `n_words' to be `scm_t_uint32'.
* libguile/inline.h: Update extraneous declaration.
2012-03-07 22:50:44 +01:00
Andy Wingo
0aed71aa51 Revert "add SCM_HEAP_OBJECT_BASE"
This reverts commit 47ed8656db.

Conflicts:

	libguile/foreign.c
2012-01-31 22:58:24 +01:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Andy Wingo
fd51e66190 attempt to handle steady-state mallocations better
* libguile/gc-malloc.c (scm_realloc): Call the new
  scm_gc_register_allocation() here.  If we have to collect, do a
  GC_gcollect_and_unmap.

* libguile/gc.c (scm_gc_register_allocation): Add a routine to track
  steady-state mallocation, and cause gc to run if there is a high
  mallocation rate.
  (adjust_gc_frequency): Reset the bytes-until-GC countdown timer.
2011-11-29 21:36:31 +01:00
Andy Wingo
fbe1cb7f64 remove public scm_protects export
* libguile/gc.h:
* libguile/gc.c: Remove scm_protects from the API.  It is deprecated on
  stable-2.0.
2011-11-24 11:47:36 +01:00
Andy Wingo
f0d1bacd78 deprecate direct scm_protects access
* libguile/gc.h:
* libguile/gc.c: Deprecate direct access to scm_protects.
2011-11-21 10:56:29 +01:00
Andy Wingo
47ed8656db add SCM_HEAP_OBJECT_BASE
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro.  Given a SCM,
  returns a pointer to the start of its memory area on the heap.

* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
2011-10-24 18:59:35 +02:00
Andy Wingo
21041372ed add SCM_{PACK,UNPACK}_POINTER
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros.
  The old SCM2PTR and PTR2SCM were defined in such a way that
  round-tripping through a pointer could lose precision, even in the
  case in which you weren't interested in actually dereferencing the
  pointer, it was simply that you needed to plumb a SCM through APIs
  that take pointers.  These new macros are more like SCM_PACK and
  SCM_UNPACK, but for pointer types.  The bit representation of the
  pointer should be the same as the scm_t_bits representation.

* libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS
  pointers.  We are going to try tagging the SCM object itself in the
  future, and I don't think that keeping this support is worth its
  cost.  It probably doesn't work anyway.

* libguile/backtrace.c:
* libguile/bytevectors.c:
* libguile/continuations.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/hashtab.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/smob.c:
* libguile/strings.c:
* libguile/symbols.c:
* libguile/vm.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Update many sites to use the new macros.
2011-10-24 18:54:04 +02:00
Andy Wingo
ff670362aa scm_cell, scm_double_cell, scm_words back to gc.h
* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
  declarations and definitions back here, from inline.h.  It's more
  natural.

* libguile/inline.c: Include gc.h as well.
2011-05-26 17:10:25 +02:00
Andy Wingo
4cf77f0946 simplify inline function infrastructure
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
  from inline.h.  We'd like to support inline function definitions in
  more header files: not just inline.h.
  (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
  definitions.

* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
  wrappers, which redirect to the GC_MALLOC macros when building Guile,
  and the scm_gc_malloc functions otherwise.  A step towards getting
  BDW-GC out of Guile's API.

* libguile/inline.h: Simplify, using SCM_INLINE,
  SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES.  Also use the
  new SCM_GC_MALLOC macros.
2011-05-26 17:10:01 +02:00
Andy Wingo
fc7bd367ab remove all deprecated code
* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code.  CPP defines
  that were not previously issuing warnings were changed so that their
  expansions would indicate the replacement forms to use,
  e.g. scm_sizet__GONE__REPLACE_WITH__size_t.

  The two exceptions were SCM_LISTN, which did not produce warnings
  before, and the string-filter argument order stuff.

  Drops the initial dirty memory usage of Guile down to 2.8 MB on my
  machine, from 4.4 MB.
2011-05-12 14:01:26 +02:00
Ludovic Courtès
8c93b597b3 Fix the visibility of a few of internal symbols.
* libguile/gc.h (scm_i_gc): Make internal.
* libguile/posix.h (scm_i_locale_mutex): Likewise.
* libguile/arrays.h (scm_i_tc16_array): Likewise.
* libguile/numbers.c (scm_i_num_less_p): Likewise.
* libguile/discouraged.h (scm_i_init_discouraged): Likewise.
* libguile/continuations.c (scm_i_dummy): Made static.
* libguile/gc.c (scm_i_cell_validation_already_running): Likewise.
* libguile/discouraged.h (scm_i_init_discouraged): Likewise.
2010-05-28 17:02:13 +02:00
Ludovic Courtès
e3401c659e Use GCC's `malloc' attribute for malloc-like routines.
* libguile/__scm.h (SCM_MALLOC): New macro.

* libguile/gc.h (scm_malloc, scm_calloc, scm_strdup, scm_strndup,
  scm_gc_malloc_pointerless, scm_gc_calloc, scm_gc_malloc,
  scm_gc_strdup, scm_gc_strndup): Mark as `SCM_MALLOC'.
2010-05-28 17:02:13 +02:00
Ludovic Courtès
acbccb0c83 Reinstate `scm_protects', for backward compatibility.
Partly reverts e7efe8e793 ("decruftify
scm_sys_protects").

* libguile/gc.c (protects): Rename to...
  (scm_protects): ... this.

* libguile/gc.h (scm_protects): Add declaration.
2010-02-13 19:33:51 +01:00
Andy Wingo
562cd1b8f8 more boot cleanup
* libguile/bytevectors.c (scm_bootstrap_bytevectors): Remove a call to
  scm_gc_protect_object.

* libguile/gc.h:
* libguile/gc.c (scm_init_gc_protect_object): Rename from
  scm_init_storage, and just return void. Make the GC boot procs have
  internal linkage.

* libguile/init.c: Adapt to the name change.
2009-12-05 11:44:09 +01:00
Ludovic Courtès
0eb934f1f0 Use `SCM_DEPRECATED' in declarations of deprecated functions/variables.
* libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro.

* libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.

* libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.

* libguile/async.h, libguile/deprecated.h, libguile/eval.h,
  libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h,
  libguile/srfi-4.h, libguile/strings.h: Change declarations of
  deprecated functions and variables to use `SCM_DEPRECATED' instead of
  `SCM_API'.
2009-10-02 14:48:22 +02:00
Ludovic Courtès
6dc797eee9 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	libguile/gc_os_dep.c
2009-09-09 22:39:49 +02:00
Ken Raeburn
5f5e7a2cd6 Make test-case compilation with -DSCM_DEBUG=1 work.
* gc.h (scm_i_expensive_validation_check): Declare SCM_API.
2009-09-03 16:59:11 -04:00
Ludovic Courtès
760fb97d1f Remove deprecated variables/macros from the GC headers.
* libguile/deprecated.c (scm_mtrigger, scm_mallocated,
  scm_max_segment_size): New global variables, from gc.c.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs.

* libguile/deprecated.h (scm_mallocated, scm_mtrigger,
  scm_max_segment_size): New declarations.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New
  declarations.

* libguile/gc-malloc.c (scm_i_minyield_malloc): Remove.
  (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and
  `scm_mtrigger'.

* libguile/gc.c (scm_mtrigger, scm_mallocated): Remove.
  (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'.

* libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC,
  SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2,
  scm_mallocated, scm_mtrigger): Remove.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED &&
  GUILE_DEBUG_FREELIST]: Remove.

* libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1,
  SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2,
  DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE,
  SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE,
  SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove.
  (scm_getenv_int): Made internal.
  (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return,
  scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist,
  scm_gc_init_segments, scm_gc_init_mark): Remove declarations.

* libguile/gc-segment-table.c: Remove, finally.
2009-08-28 21:02:42 +02:00
Ludovic Courtès
f86f3b5b11 Remove the `scm_tc_free_cell' SMOB type.
* libguile/deprecated.h (SCM_FREEP, SCM_NFREEP): Changed to constants.

* libguile/gc.c (scm_i_tag_name): Remove reference to
  `scm_tc_free_cell'.

* libguile/gc.h (SCM_FREE_CELL_CDR, SCM_SET_FREE_CELL_CDR): Remove.

* libguile/smob.c (free_print): Remove.
  (scm_smob_prehistory): Don't create the "free" SMOB type.

* libguile/struct.c (struct_finalizer_trampoline): Use a bare
  `scm_tc3_struct' tag for finalized structs instead of
  `scm_tc_free_cell'.

* libguile/tags.h (scm_tc_free_cell): Remove.
2009-08-25 23:57:49 +02:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
2009-08-18 00:06:45 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
85d7012ec3 Remove references to `scm_in_heap_p ()'.
* libguile/gc.c (scm_i_expensive_validation_check): Don't call
  `scm_in_heap_p ()'.  Cells don't necessarily live in the heap
  nowadays.

* libguile/gc.h (scm_in_heap_p): Remove declaration.
2009-03-22 16:13:12 +01:00
Ludovic Courtès
7f9ec18a1f Expose `GC_dump ()' at the Scheme level.
* libguile/gc.h (scm_gc_dump): New declaration.

* libguile/gc.c (scm_gc_dump): New function.
2008-10-23 17:46:08 +02:00
Ludovic Courtès
6033d3266c Remove per-thread `gc_running_p'.
* libguile/gc.c (scm_gc): Don't use `scm_gc_running_p' as
  an lvalue.

* libguile/gc.h (scm_gc_running_p): Define to 0.

* libguile/threads.h (scm_i_thread)[gc_running_p]: Remove.
2008-09-18 00:04:38 +02:00
Ludovic Courtès
f5cc9619df Remove GC-related fields from `scm_i_thread'.
* libguile/gc.h (scm_i_freelist, scm_i_freelist2): Remove declarations.

* libguile/threads.c (resume): Don't use `t->clear_freelists_p' and
  `scm_i_freelist{,2}'.
  (scm_enter_guile, scm_leave_guile, guilify_self_1): Don't use
  the `heap_mutex' and other fields removed from `scm_i_thread'.
  (scm_i_freelist, scm_i_freelist2): Remove.

* libguile/threads.h (scm_i_thread)[heap_mutex, freelist, freelist2,
  clear_freelists_p]: Remove.
2008-09-17 23:37:31 +02:00
Han-Wen Nienhuys
b71c8ec90a Revise GC asserts.
* libguile/gc.c (scm_i_gc): Change assert into printed warning.

* libguile/private-gc.h (nil): introduce scm_i_last_marked_cell_count,
  as a private mechanism for maintaining cell counts.  Remove variable
  scm_cells_allocated.
2008-09-11 12:10:58 -03: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
071e0d9329 Remove `scm_get_stack_base ()'.
* libguile/threads.c: Replace `scm_get_stack_base ()' by
  `GC_stackbottom'.

* libguile/gc.h (scm_get_stack_base): Remove declaration.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-7
2008-09-10 22:52:03 +02:00
Ludovic Courtes
b74e86cf5f Fixed warnings due to unused stuff.
* libguile/gc.c (scm_cells_allocated, scm_last_cells_allocated,
  scm_gc_cells_collected, scm_gc_cells_collected_1,
  scm_gc_malloc_collected, scm_gc_time_taken, t_before_gc,
  scm_gc_mark_time_taken, scm_gc_times, scm_gc_cells_swept,
  scm_gc_cells_marked_acc, scm_gc_cells_swept_acc,
  scm_gc_cell_yield_percentage, scm_gc_malloc_yield_percentage):
  Removed.

* libguile/gc.h: Updated accordingly.

* libguile/gdbint.c (port_mark_p, stream_mark_p, string_mark_p,
  unmark_port, remark_port): Removed.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-4
2008-09-10 22:45:59 +02:00
Ludovic Courtès
35a9197ccc Merge commit 'f30e1bdf97' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/coop-pthreads.c
	libguile/gc-freelist.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/private-gc.h
	test-suite/tests/environments.nottest
2008-09-10 22:27:30 +02:00