* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE): Bump a bit farther (2 MB on
64-bit, 1 MB on 32-bit) as we now expand to this size instead of
expanding by this amount.
(scm_storage_prehistory): Expand to the initial heap size instead of
expanding by the size.
* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE): Bump to 1.6 MB on 64-bit
targets, or 800 kB on 32-bit targets, to account for increased
footprint. Prevents useless early GC.
(scm_storage_prehistory): Remove unused code to dynamically change the
free space divisor.
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.
* 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.
* libguile/gc.c (scm_storage_prehistory): Register struct displacement
here.
* libguile/goops.c (scm_sys_modify_instance): Fix the format of a
comment.
* libguile/modules.c (scm_post_boot_init_modules): Update for new format
of struct vtable references.
* libguile/struct.c (scm_i_alloc_struct): Update to include slots
directly, instead of being indirected by an embedded pointer.
(scm_c_make_structv, scm_allocate_struct, scm_i_make_vtable_vtable):
Adapt to pass vtable bits as argument to scm_i_alloc_struct, not
vtable data bits.
(scm_init_struct): Remove two-word displacement from libgc.
* libguile/struct.h: Update comment.
(SCM_STRUCT_SLOTS, SCM_STRUCT_DATA): Update definitions.
(SCM_STRUCT_VTABLE_DATA, SCM_STRUCT_VTABLE_SLOTS): Remove.
(SCM_STRUCT_VTABLE, SCM_STRUCT_LAYOUT, SCM_STRUCT_PRINTER)
(SCM_STRUCT_FINALIZER, SCM_STRUCT_VTABLE_FLAGS)
(SCM_STRUCT_VTABLE_FLAG_IS_SET): Simplify definitions.
* module/system/base/types.scm (cell->object, address->inferior-struct):
Adapt to struct representation change.
This avoids a deadlock due to the lookup of cur_warnport_fluid while an
allocation is ongoing.
* libguile/gc.c (scm_gc_warn_proc): Write the warning directly to
stderr.
* libguile/dynl.c:
* libguile/gc.c:
* libguile/keywords.c:
* libguile/scmsigs.c:
* libguile/stime.c: Use scm_i_dynamic_link instead of scm_dynamic_link
so that things compile in without-threads configurations.
* libguile/root.h:
* libguile/root.c: Remove these files.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_cwdr, scm_call_with_dynamic_root)
(scm_dynamic_root, scm_apply_with_dynamic_root): Deprecate.
Remove all root.h usage, which was vestigial.
* module/ice-9/serialize.scm: Use (current-thread) instead
of (dynamic-root).
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.
* libguile/__scm.h (SCM_TICK): Always define as scm_async_tick().
* libguile/error.c (scm_syserror, scm_syserror_msg):
* libguile/fports.c (fport_read, fport_write):
* libguile/_scm.h (SCM_SYSCALL): Replace SCM_ASYNC_TICK with
scm_async_tick ().
(SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE)
(SCM_ASYNC_TICK_WITH_GUARD_CODE): Remove internal definitions. We
inline into vm-engine.c, the only place where it matters.
* libguile/async.h:
* libguile/async.c (scm_async_tick, scm_i_setup_sleep):
(scm_i_reset_sleep, scm_system_async_mark_for_thread):
* libguile/threads.h (struct scm_thread_wake_data):
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (block_self, guilify_self_1, scm_std_select):
Rewrite to use sequentially-consistent atomic references.
* libguile/atomics-internal.h (scm_atomic_set_pointer):
(scm_atomic_ref_pointer): New definitions.
* libguile/finalizers.c (queue_finalizer_async): We can allocate, so
just use scm_system_async_mark_for_thread instead of the set-cdr!
shenanigans.
* libguile/scmsigs.c (take_signal):
* libguile/gc.c (queue_after_gc_hook): Adapt to new asyncs mechanism.
Can't allocate but we're just manipulating the current thread when no
other threads are running so we should be good.
* libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline the async_tick
business.
* 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.
* libguile/gc.c: Remove code that would try to run GC more frequently as
the process image size was increasing. Before, it was often the case
that the heap was the main component of image size, but with
expandable stacks and statically allocated data that is no longer
true. Also, once scm_gc_register_allocation was incorporated, we
don't need to be so conservative any more. It seems this code was
simply causing too many gc's to run. Removing it improves some
micro-benchmarks; time will tell.
* 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.
* libguile/fluids.c (new_fluid): Don't run an explicit GC for the first
fluid.
* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE, scm_storage_prehistory):
Enlarge from 32 kB to 512 or 1024 kB, depending on word size. Reduces
startup time by 10 or 15% by avoiding excessive
GC.
* libguile/private-gc.h: Remove SCM_DEFAULT_INIT_HEAP_SIZE_2 definition
here.
* libguile/Makefile.am:
* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Remove the old VM files, and the rules to
build the .i files.
* libguile/vm-engine.c:
* libguile/vm.c: Remove the old VM. Woot!
* libguile/_scm.h (SCM_OBJCODE_COOKIE, SCM_OBJCODE_ENDIANNESS_OFFSET)
(SCM_OBJCODE_WORD_SIZE_OFFSET): Remove.
* libguile/evalext.c (scm_self_evaluating_p): Remove objcode and program
cases.
* libguile/frames.c (scm_frame_num_locals, scm_frame_previous): Remove
program cases.
* libguile/gc.c (scm_i_tag_name): Remove objcode case.
* libguile/goops.c (scm_class_of, create_standard_classes): Remove
objcode and program cases.
* libguile/instructions.h:
* libguile/instructions.c (scm_instruction_list, scm_instruction_p)
(scm_instruction_length, scm_instruction_pops, scm_instruction_pushes)
(scm_instruction_to_opcode, scm_opcode_to_instruction): Remove old VM
code.
* libguile/objcodes.h:
* libguile/objcodes.c: Remove the objcode data type, and handling for
objcode files.
* libguile/print.c: Remove objcode and program printers.
* libguile/procprop.c: Remove program cases.
* libguile/procs.c:
* libguile/programs.h:
* libguile/programs.c: Remove old program code.
* libguile/smob.c: Remove objcodes include.
* libguile/snarf.h: Remove static program defines.
* libguile/stacks.c: Remove program case.
* libguile/tags.h: Remove program and objcode tc7s.
* module/ice-9/session.scm (procedure-arguments)
* module/language/tree-il/analyze.scm (validate-arity)
* module/statprof.scm (get-call-data, procedure=?)
* module/system/vm/frame.scm (frame-bindings)
(frame-call-representation): Remove old program cases.
* module/system/repl/debug.scm (frame->module): Add a FIXME.
* module/system/vm/instruction.scm: Remove old exports.
* module/system/vm/program.scm: Remove old program code.
* configure.ac: Check for `GC_set_all_interior_pointers',
`GC_get_gc_no', and `GC_set_java_finalization'.
* libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'.
(scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use
`GC_set_all_interior_pointers'.
* libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]:
Use `GC_set_java_finalization'.
* libguile/gc.c: Remove shims for GC_get_heap_usage_safe,
GC_get_free_space_divisor, and GC_set_finalize_on_demand. Remove code
in the case in which we did not have GC_set_start_callback.