summaryrefslogtreecommitdiff
path: root/libguile/gc.h
Commit message (Collapse)AuthorAgeFilesLines
* Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint typesAndy Wingo2018-06-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Update license notices in all C filesAndy Wingo2018-06-201-17/+17
| | | | | Update to newest recommended license notices from the FSF. Everything stays LGPLv3+ except guile-readline which is GPLv3+.
* Remove (C) from copyright statementsAndy Wingo2018-06-201-1/+1
| | | | | | 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.
* Rename __scm.h to scm.hAndy Wingo2018-06-201-1/+0
| | | | * libguile/scm.h: Rename. Update all includers.
* Remove Emacs local variables comments in Guile sourceAndy Wingo2018-06-201-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove useless "classes: h_files" from Guile headers.Andy Wingo2018-06-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Shuffle around inline C function implementationAndy Wingo2018-06-201-1/+1
| | | | | | | | | | | | | | * 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.
* Devolve more validate macrosAndy Wingo2018-06-181-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Refactor handling of auxiliary stacks and setjmp/longjmpAndy Wingo2018-06-171-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Remove unused getters for register backing store baseAndy Wingo2018-06-171-3/+2
| | | | | | * libguile/gc.h: * libguile/threads.c: Remove unused implementations of scm_ia64_register_backing_store_base, as libgc does this for us.
* Remove SCM_DEBUG_CELL_ACCESSES==1Andy Wingo2016-11-181-42/+12
| | | | | | | | | | | | | | | | | | | 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.
* Out-of-memory situations raise exceptions instead of abortingAndy Wingo2014-03-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Merge commit 'd364a8971828e38e8f9112b711066f4962bb400e'Andy Wingo2013-11-281-1/+0
|\ | | | | | | | | | | Conflicts: libguile/deprecated.h libguile/gc.c
| * Deprecate gc-live-object-statsAndy Wingo2013-11-281-1/+0
| | | | | | | | | | | | | | | | * 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.
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-04-141-1/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add 'scm_gc_typed_calloc' macro.Mark H Weaver2013-04-011-1/+3
| | | | | | | | * libguile/gc.h (scm_gc_typed_calloc): New macro.
| * scm_cell, scm_double_cell, scm_words back to gc.hAndy Wingo2012-03-081-0/+97
| | | | | | | | | | | | | | | | | | * 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.
| * simplify inline function infrastructureAndy Wingo2012-03-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Change `scm_words' to accept a 32-bit word number.Ludovic Courtès2012-03-071-3/+4
| | | | | | | | | | | | | | | | 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.
* | Revert "add SCM_HEAP_OBJECT_BASE"Andy Wingo2012-01-311-7/+5
| | | | | | | | | | | | | | | | This reverts commit 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3. Conflicts: libguile/foreign.c
* | Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2011-12-011-0/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | 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
| * attempt to handle steady-state mallocations betterAndy Wingo2011-11-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | * 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.
| * deprecate direct scm_protects accessAndy Wingo2011-11-211-2/+4
| | | | | | | | | | * libguile/gc.h: * libguile/gc.c: Deprecate direct access to scm_protects.
* | remove public scm_protects exportAndy Wingo2011-11-241-1/+0
| | | | | | | | | | | | * libguile/gc.h: * libguile/gc.c: Remove scm_protects from the API. It is deprecated on stable-2.0.
* | add SCM_HEAP_OBJECT_BASEAndy Wingo2011-10-241-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | add SCM_{PACK,UNPACK}_POINTERAndy Wingo2011-10-241-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | scm_cell, scm_double_cell, scm_words back to gc.hAndy Wingo2011-05-261-0/+97
| | | | | | | | | | | | | | | | | | * 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.
* | simplify inline function infrastructureAndy Wingo2011-05-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | remove all deprecated codeAndy Wingo2011-05-121-37/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix the visibility of a few of internal symbols.Ludovic Courtès2010-05-281-1/+1
| | | | | | | | | | | * 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.
* Use GCC's `malloc' attribute for malloc-like routines.Ludovic Courtès2010-05-281-9/+14
| | | | | | | | * 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'.
* Reinstate `scm_protects', for backward compatibility.Ludovic Courtès2010-02-131-1/+2
| | | | | | | | | | Partly reverts e7efe8e793fa51ea898aea4477939c598b3e9fac ("decruftify scm_sys_protects"). * libguile/gc.c (protects): Rename to... (scm_protects): ... this. * libguile/gc.h (scm_protects): Add declaration.
* more boot cleanupAndy Wingo2009-12-051-3/+3
| | | | | | | | | | | | * 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.
* Use `SCM_DEPRECATED' in declarations of deprecated functions/variables.Ludovic Courtès2009-10-021-16/+16
| | | | | | | | | | | | | | * 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'.
* Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2009-09-091-1/+1
|\ | | | | | | | | Conflicts: libguile/gc_os_dep.c
| * Make test-case compilation with -DSCM_DEBUG=1 work.Ken Raeburn2009-09-031-1/+1
| | | | | | | | * gc.h (scm_i_expensive_validation_check): Declare SCM_API.
* | Remove deprecated variables/macros from the GC headers.Ludovic Courtès2009-08-281-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Remove the `scm_tc_free_cell' SMOB type.Ludovic Courtès2009-08-251-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2009-08-181-6/+7
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Change Guile license to LGPLv3+Neil Jerram2009-06-171-6/+7
| | | | | | | | | | | | | | | | | | | | (Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
| * Revise GC asserts.Han-Wen Nienhuys2008-09-111-1/+0
| | | | | | | | | | | | | | | | * 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.
* | Remove references to `scm_in_heap_p ()'.Ludovic Courtès2009-03-221-2/+1
| | | | | | | | | | | | | | | | * 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.
* | Expose `GC_dump ()' at the Scheme level.Ludovic Courtès2008-10-231-0/+1
| | | | | | | | | | | | * libguile/gc.h (scm_gc_dump): New declaration. * libguile/gc.c (scm_gc_dump): New function.
* | Remove per-thread `gc_running_p'.Ludovic Courtès2008-09-181-1/+1
| | | | | | | | | | | | | | | | | | * 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.
* | Remove GC-related fields from `scm_i_thread'.Ludovic Courtès2008-09-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2008-09-101-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Cleanup mark-during-GC debug checks.Han-Wen Nienhuys2008-09-091-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * Garbage collection cleanup.Han-Wen Nienhuys2008-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * Introduce scm_i_marking to detect when GC mark bits are touchedHan-Wen Nienhuys2008-08-161-0/+2
| | | | | | | | outside of marking stage.
| * Add `SCM_INTERNAL' macro, use it.Ludovic Courtès2008-05-311-5/+5
| |