* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size)
(test-target): The objcode version embedded in the cookie is not an
effective version, so elide it from the test.
* libguile/ports.h (struct scm_t_port): Make the lock into a pointer
field instead of an inline field. It should be possible to make
unlocked ports by having a NULL lock field.
(scm_c_lock_port, scm_c_try_lock_port): Return the mutex if the port
was actually locked.
(scm_c_unlock_port): Remove.
* libguile/ports.c (scm_c_make_port_with_encoding): For now, leave
`lock' set to 0.
Change scm_c_lock_port callers to pay attention to the new API.
* libguile/print.c (scm_write, scm_display): Fix call to
dynwind-lock-port for ports-with-print-states.
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
(scm_set_current_warning_port): New functions, wrapping the Scheme
parameter.
* module/ice-9/boot-9.scm (current-warning-port): New parameter,
defining a port for warnings.
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
(parameter-fluid, parameter-converter, parameterize): New top-level
bindings, implementing SRFI-39 parameters. Currently,
current-input-port and similar procedures are not yet parameters.
* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
tests.
* libguile/private-options.h (SCM_PRINT_ESCAPE_NEWLINES_P):
* libguile/print.c: Add new escape-newlines print option, defaulting to
on.
(write_character): For newlines, if SCM_PRINT_ESCAPE_NEWLINES_P, then
print them as \n.
(scm_init_print): Refactor print options initialization.
* module/system/repl/command.scm (language): Set the
*current-language*.
* module/system/repl/repl.scm (start-repl): Create a new dynamic scope
for *current-language*.
* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc,
custom_gmp_free): New static functions used by GMP for allocation.
These are just wrappers for scm_malloc, scm_realloc, and free.
(scm_init_numbers): If scm_install_gmp_memory_functions is nonzero,
use mp_set_memory_functions to configure GMP to use
custom_gmp_{malloc,realloc,free} for memory allocation.
(scm_bigprint): Ask gmp for the function used to deallocate the string
returned by mpz_get_str.
* libguile/numbers.h: Declare scm_install_gmp_memory_functions.
* libguile/guile.c: When running the Guile binary, install the
gmp_memory_functions.
Based on a patch by Mark H Weaver <mhw@netris.org>.
* 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.
* libguile/threads.c (scm_call_with_new_thread): Collect a little before
making a new thread. Our adjust_gc_frequency hack doesn't work well
if the main allocation load is thread creation, as in
https://savannah.gnu.org/bugs/?34140. This does not appreciably
affect the speed of the test in that bug, but does effectively limit
the image size.
* configure.ac: Check for GC_get_free_space_divisor.
* libguile/gc.c (GC_get_free_space_divisor): Define an implementation,
if needed.
(accumulate_gc_timer): Fix indentation.
(get_image_size): New terrible hack. Needs implementations on other
platforms.
(adjust_gc_frequency): Attempt to adjust the GC frequency based on
process image growth. Needs more comments.
(scm_init_gc): Add the adjust_gc_frequency to the after_gc_c_hook.
* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
to PROC.
* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
retained"]: New test.
* libguile/struct.h:
* libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can
handle most of the use cases with make-vtable, and we don't want to
promote the creation of new roots to the type hierarchy.
(scm_i_make_vtable_vtable): The internal replacement.
* libguile/options.c (change_option_setting, scm_init_options): Rely on
the options being allocated in GC-able memory, as in static memory.
Therefore there is no need for the gc-protect dance.
* module/web/http.scm (default-val-validator): Valid with no value.
(key-value-list?): Keys are always symbols, do not accept strings.
(validate-param-list): Apply `valid?' to list elements.
(validate-credentials): Validate param for Basic scheme, which
is parsed as a string.
(declare-symbol-list-header!): `list-of?' args were in wrong order.
("Cache-Control"): Replace `default-val-validator' with more
specific procedure.
("Accept"): Validate on first param which has no value.
* am/guilec (.scm.go): Use `-L' to specify the search path.
* module/Makefile.am (ice-9/psyntax-pp.go): Likewise.
* meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH,
$GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when
cross-compiling.
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
default value in the dynamic-state vector to be SCM_UNDEFINED instead
of SCM_BOOL_F. If the value in the dynamic-state is #f, default to a
value attached to the fluid instead. This allows useful default
values.
(scm_make_fluid_with_default): New function, allows the user to
specify a default value for the fluid. Defaults to #f. Bound to
`make-fluid' on the Scheme side.
(scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
threads.
(scm_fluid_unset_x): Also unset the default value. Not sure if this
is the right thing.
(fluid_ref): Update to the new default-value strategy.
* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
strategy.
* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
threads. Fixes http://debbugs.gnu.org/10093.