| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
(DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and
syntax.h.
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init):
* libguile/init.c (scm_init_guile):
* libguile/print.c (iprin1):
* libguile/tags.h (scm_tc7_syntax):
* module/oop/goops.scm (<syntax>):
* module/system/base/types.scm (%tc7-syntax, cell->object):
* module/system/vm/disassembler.scm (code-annotation): Wire up the new
data type.
* libguile/syntax.c:
* libguile/syntax.h: New files.
* module/ice-9/boot-9.scm: Move new definitions to (system syntax
internal).
* module/system/syntax.scm (print-syntax): New helper.
* module/system/vm/assembler.scm (statically-allocatable?)
(intern-constant, link-data): Arrange to be able to write syntax
objects into images.
* module/language/cps/types.scm (&syntax): New type. Remove
&hash-table; it was never detected, an internal binding, and we need
the bit to avoid going into bignum territory.
|
|
|
|
|
| |
* libguile/i18n.c (scm_nl_langinfo): unpack INT_P_SEP_BY_SPACE as bool
* test-suite/tests/i18n.test (nl-langinfo et al.): new tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/finalizers.c (async_gc_finalizer):
(scm_i_register_async_gc_callback): Replace "weak gc callback"
mechanism with "async gc callback" mechanism. Very similar but the
new API is designed to be called a bounded number of times, to avoid
running afoul of libgc heuristics.
* libguile/weak-list.h: New internal header.
* libguile/Makefile.am (noinst_HEADERS): Add weak-list.h.
* libguile/weak-set.c (vacuum_all_weak_sets):
(scm_c_make_weak_set, scm_init_weak_set):
* libguile/weak-table.c (vacuum_all_weak_tables):
(scm_c_make_weak_table, scm_init_weak_table): Arrange to vacuum all
weak sets from a single async GC callback, and likewise for weak
tables.
Thanks to Ludovic Courtès for tracking this bug down!
|
|
|
|
|
|
|
|
|
| |
* libguile/atomics-internal.h (scm_atomic_subtract_uint32):
(scm_atomic_compare_and_swap_uint32, scm_atomic_set_pointer):
(scm_atomic_ref_pointer, scm_atomic_set_scm):
(scm_atomic_ref_scm, scm_atomic_swap_scm):
(scm_atomic_compare_and_swap_scm): Use C11 atomic types if we have
loaded C11 stdatomic.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/ref/vm.texi (Inlined Scheme Instructions): Add string-set!.
* libguile/vm-engine.c (string-set!): New opcode.
* module/ice-9/rdelim.scm (read-string): Reimplement in terms of a
geometrically growing list of strings, to reduce total heap usage when
reading big files.
* module/language/cps/compile-bytecode.scm (compile-function): Add
string-set! support.
* module/language/cps/types.scm (string-set!): Update for &u64 index.
* module/language/tree-il/compile-cps.scm (convert): Unbox index to
string-set!.
* module/system/vm/assembler.scm (system): Export string-set!.
|
|
|
|
|
| |
* libguile/ports.c (update_port_position): Only fetch line if we need to
increment it.
|
|
|
|
|
|
|
|
| |
* module/system/vm/linker.scm (*lcm-page-size*): Rename
from *page-size*, change to 64 KB.
* libguile/loader.c (load_thunk_from_memory): Only require page size
alignment, knowing that although Guile might emit ELF with 64k
alignment, it only really needs page alignment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/fluids.h (struct scm_dynamic_state): Add thread_local_values
table. Thread locals are flushed to a separate thread-local table.
The references are strong references since the table never escapes the
thread.
(scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
functions.
* libguile/fluids.c (FLUID_F_THREAD_LOCAL):
(SCM_I_FLUID_THREAD_LOCAL_P): New macros.
(restore_dynamic_state): Add comment about precondition.
(save_dynamic_state): Flush thread locals.
(scm_i_fluid_print): Print thread locals nicely.
(new_fluid): Add flags arg.
(scm_make_fluid, scm_make_fluid_with_default, scm_make_unbound_fluid):
Adapt.
(scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
functions.
(fluid_set_x): Special flushing logic for thread-locals.
(fluid_ref): Special cache miss logic for thread locals.
* libguile/stacks.c (scm_init_stacks):
* libguile/throw.c (scm_init_throw): %stacks and %exception-handler are
thread-locals.
* libguile/threads.c (guilify_self_2): Init thread locals table.
* test-suite/tests/fluids.test ("dynamic states"): Add test.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add link to
Thread-Local Variables.
* doc/ref/api-scheduling.texi (Thread Local Variables): Update with real
thread-locals.
* NEWS: Update.
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (HAVE_USABLE_GETITIMER_PROF, HAVE_USABLE_GETITIMER_VIRTUAL): new tests
* doc/ref/posix.texi (setitimer, getitimer): document provided? 'ITIMER_VIRTUAL and 'ITIMER_PROF
* doc/ref/statprof.texi (statprof): document ITIMER_PROF requirements
* libguile/scmsigs.c (scm_setitimer, scm_getitimer): document (provided? 'ITIMER_VIRTUAL) and (provided? 'ITIMER_PROF)
(scm_init_scmsigs): add features ITIMER_VIRTUAL and ITIMER_PROF
* test-suite/tests/asyncs.test ("prevention via sigprof"): throw when unsupported
* test-suite/tests/signals.test: throw when not supported
* test-suite/tests/statprof.test: throw when not supported
|
|
|
|
|
| |
* libguile/loader.c [!HAVE_SYS_MMAN_H] (map_file_contents): updated
variables and function calls to the current names
|
|
|
|
|
|
|
| |
Reported by Jan Nieuwenhuizen <janneke@gnu.org>
at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20272#36>.
* libguile/Makefile.am (libpath.h): Honor 'SOURCE_DATE_EPOCH'.
|
|
|
|
|
|
| |
* libguile/posix.c (scm_system_star): Cast 'SIG_IGN' to
'scm_t_uintptr_t' and use 'scm_from_uintptr_t'. This fixes an
'int-conversion' warning with GCC 6.2.
|
|
|
|
|
|
|
|
|
|
| |
Fixes <http://bugs.gnu.org/24659>.
* libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is
unbound; instead, use 0777 as the mode. Update docstring to clarify
this.
* doc/ref/posix.texi (File System): Adjust accordingly.
* NEWS: Mention it.
|
|
|
|
|
|
| |
* libguile/ports.c (scm_sys_port_encoding)
(scm_sys_set_port_encoding_x): Require an open port, to match 2.0
behavior.
|
|
|
|
|
|
|
|
|
|
| |
Fixes <https://bugs.gentoo.org/show_bug.cgi?id=590528>.
* libguile/Makefile.am (BUILT_INCLUDES): New variable.
(BUILT_SOURCES): Put generated .h to BUILT_INCLUDES.
(DOT_X_FILES, EXTRA_DOT_X_FILES, DOT_DOC_FILES, EXTRA_DOT_DOC_FILES):
Depend on $(BUILT_INCLUDES), in place of scmconfig.h which is included
in $(BUILT_INCLUDES).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This assumption does not hold on systems that use the LLP64 data model.
Partially fixes <https://debbugs.gnu.org/22406>.
Reported by Peter TB Brett <peter@peter-b.co.uk>.
* libguile/numbers.h (scm_t_inum): Move here from numbers.c, and change
to be equivalent to 'long' (formerly 'scm_t_signed_bits').
(SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Define based on
SCM_I_FIXNUM_BIT instead of SCM_T_SIGNED_BITS_MAX.
(SCM_I_INUM): Adjust definitions to return a 'scm_t_inum', and avoiding
the assumption that SCM_UNPACK returns a 'long'.
* libguile/numbers.c (scm_t_inum): Move definition to numbers.h.
Verify that 'scm_t_inum' fits within a SCM value.
(scm_i_inum2big): Remove preprocessor code that forced a compile error
unless sizeof (long) == sizeof (void *).
|
|
|
|
|
|
|
|
| |
Reported by Miroslav Lichvar <mlichvar@redhat.com>
in <https://lists.gnu.org/archive/html/guile-devel/2016-02/msg00045.html>
* libguile/conv-integer.i.c: Avoid signed overflow.
* libguile/numbers.c (scm_is_signed_integer): Avoid signed overflow.
|
|
|
|
|
| |
* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument
is string. Fixes #25498.
|
|
|
|
|
|
|
| |
* doc/ref/posix.texi (Ports and File Descriptors): Update.
* libguile/filesys.c (scm_select): Use scm_std_select so that pending
interrupts can be delivered. On EINTR or EAGAIN, just return directly
so that calling Scheme code can run asyncs.
|
|
|
|
|
| |
* libguile/threads.c (scm_std_select): If there are unblocked asyncs
pending, return directly instead of ticking ourselves.
|
|
|
|
|
|
| |
* libguile/filesys.c (scm_i_mkstemp): Validate "mode" argument as a
string, and validate writability of template string early too. Thanks
to Jean Louis for the bug report.
|
|
|
|
|
|
| |
* libguile/strports.c (string_port_truncate):
(scm_make_string_port_type): Support truncate-file on string ports.
* test-suite/tests/ports.test ("string ports"): Add tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/vm-engine.c (bind-kwargs):
* libguile/vm.c (vm_error_kwargs_missing_value):
* libguile/eval.c (error_missing_value)
(prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior.
* libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise.
* module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw)
with a "Keyword argument has no value" instead of the horrible "odd
argument list length". Also adapts to the expected args format for
the keyword-argument-error exception printer in all cases. Matches
1.8 optargs behavior also.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value):
(missing_value_error_handler): Update test.
* test-suite/tests/optargs.test: Add tests.
|
|
|
|
|
|
|
| |
* libguile/init.c (scm_i_init_guile): Move scm_register_r6rs_ports
later, so that defining port types hsa the SCM trampoline subrs
defined.
* libguile/bytevectors.c (scm_bootstrap_bytevectors): Cosmetic changes.
|
|
|
|
|
|
|
|
|
|
| |
* libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big
and scm_sym_little, and don't use the snarf mechanism as we need to
initialize this value eagerly in case the C API is used before the
Scheme module is loaded.
(scm_bootstrap_bytevectors): Initialize the endianness symbols here.
* libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS
port kinds here, for the same reason.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/threads.h (scm_i_thread): Add bool tracking whether the
thread needs to be unregistered from libgc.
* libguile/threads.c (guilify_self_1): Add needs_unregister arg.
(on_thread_exit): Only unregister thread if the thread needs it.
(scm_i_init_thread_for_guile): A thread needs unregistering if
GC_register_my_thread succeeded.
(scm_threads_prehistory): Don't unregister initial thread.
Fixes #19523. Thanks to Anthonin Bonnefoy for the report.
|
|
|
|
|
|
|
| |
* libguile/numbers.c (scm_product): Only reduce (* x -1) to (- x) when X
is a bignum. Fixes weirdness when X is not a number and instead
multiplication should dispatch to GOOPS. Thanks to Alejandro Sanchez
for the report.
|
|
|
|
|
| |
* libguile/numbers.c (log_of_fraction): Use labs instead of abs on
longs. Thanks to Matt Wette for the tip.
|
|
|
|
|
|
| |
* configure.ac: Check for __sincos.
* libguile/numbers.c (scm_c_make_polar): Fall back to __sincos if
possible. Fixes zero signedness of make-polar on macOS.
|
|
|
|
|
| |
* libguile/socket.c (scm_init_socket): Conditionally define SOCK_CLOEXEC
and SOCK_NONBLOCK. Fixes compilation on macOS.
|
|
|
|
|
| |
* libguile/numbers.c (scm_number_to_string): Use scm_from_latin1_string
where appropriate. Avoids mucking about with iconv.
|
|
|
|
|
|
| |
* libguile/strings.c (STRINGBUF_SET_MUTABLE): New helper.
(scm_i_string_ensure_mutable_x): Use new helper.
(scm_make_string): Mark stringbuf as mutable.
|
|
|
|
|
|
|
|
|
|
| |
* libguile/cache-internal.h (SCM_CACHE_SIZE): Bump to 16. It seems that
a thread accesses more than 8 fluids by default (%stacks, the
exception handler, current ports, current-fiber, port read/write
waiters) which leads every fiber to cause cache eviction and copying
the value table, which is a bottleneck. Instead just bump this cache
size.
(scm_cache_lookup): Update unrolled search.
|
|
|
|
| |
This reverts commit cd3ff33a31c51612f2247bdb15ecbe92d7da1310.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag.
Stringbufs are immutable by default.
* libguile/strings.c: Rewrite blurb. Change to have stringbufs be
immutable by default and mutable only when marked as such. Going
mutable means making a private copy.
(STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions.
(SET_STRINGBUF_SHARED): Remove.
(scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is.
(substring_with_immutable_stringbuf): New helper.
(scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy):
use new helper.
(scm_i_string_ensure_mutable_x): New helper.
(scm_i_substring_shared): Use scm_i_string_ensure_mutable_x.
(stringbuf_write_mutex): Remove; yaaaaaaaay.
(scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x. No
more mutex.
(scm_i_string_stop_writing): Now a no-op.
(scm_i_make_symbol): Use substring/copy.
(scm_sys_string_dump, scm_sys_symbol_dump): Update.
* libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove.
(SCM_I_STRINGBUF_F_MUTABLE): Add.
* module/system/vm/assembler.scm (link-data): Don't add shared flag any
more. Existing compiled flags are harmless tho.
* test-suite/tests/strings.test ("string internals"): Update.
|
|
|
|
|
|
|
|
|
| |
* libguile/strings.c (scm_string, scm_c_make_string):
* libguile/srfi-13.c (scm_reverse_list_to_string, scm_string_map)
(scm_string_unfold, scm_string_unfold_right, scm_xsubstring)
(scm_string_filter, scm_string_delete): Remove
scm_i_string_start_writing / scm_i_string_stop_writing calls around
fresh strings that aren't visible to other threads.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/cache-internal.h (struct scm_cache_entry): Add needs_flush
member.
(scm_cache_evict_1): Clear needs_flush on newly evicted entry.
(scm_cache_insert): Propagate needs_flush to new entry.
* libguile/fluids.c (restore_dynamic_state): Mark all restored entries
as needing a flush.
(save_dynamic_state): Only cons on "needs_flush" entries to the
resulting dynamic state. The result is the same as before but
avoiding the refq on the weak table.
(fluid_set_x): Propagate needs_flush down to the cache.
(fluid_ref): When adding entry to cache, use needs_flush==0.
(scm_fluid_set_x, scm_fluid_unset_x, scm_swap_fluid, swap_fluid): Use
needs_flush==1.
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/ref/posix.texi (Network Sockets and Communication): Add
documentation.
* libguile/socket.c (scm_accept4): New function, replaces accept
implementation.
(scm_accept): Call scm_accept4.
(scm_init_socket): Define SOCK_CLOEXEC and SOCK_NONBLOCK.
* libguile/socket.h: Add private scm_accept4 decl.
* module/ice-9/suspendable-ports.scm (accept): Update.
|
|
|
|
|
|
|
| |
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Switch from accept gnulib module to accept4.
* libguile/socket.c (scm_accept): Use accept4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/fports.h (scm_t_fport): Add options field.
(SCM_FDES_RANDOM_P): Deprecate.
(scm_i_fdes_to_port): Add options argument.
* libguile/fports.c (scm_i_fdes_to_port): Add options argument. Only
verify FD if SCM_FPORT_OPTION_VERIFY is there.
(scm_fdes_to_port, scm_open_file_with_encoding): Adapt to
scm_i_fdes_to_port changes.
(fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is
set.
* libguile/deprecated.h:
* libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate.
* NEWS: Add deprecation.
* libguile/filesys.c:
* libguile/ioext.c:
* libguile/posix.c:
* libguile/read.c:
* libguile/socket.c: Adapt callers.
|
|
|
|
|
|
|
| |
* libguile/continuations.c (scm_i_continuation_to_frame): Remove unused
assignment. The previous commit removed the declaration in order to
silence an unused-assignment warning, but forgot to remove the
assignment :/
|
|
|
|
|
| |
* libguile/continuations.c (scm_i_continuation_to_frame): Remove unused
variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/continuations.c (scm_i_continuation_to_frame):
* libguile/stacks.c (scm_make_stack):
* libguile/vm.c (scm_i_vm_cont_to_frame, scm_i_vm_capture_stack):
(vm_return_to_continuation_inner)
(struct vm_reinstate_partial_continuation_data):
(vm_reinstate_partial_continuation_inner):
(vm_reinstate_partial_continuation):
* libguile/vm.h (sstruct scm_vm_cont): Simplify VM continuations by
recording the top FP by offset, not value + reloc.
* libguile/frames.c (frame_offset, scm_i_vm_frame_offset): Remove unused
functions.
* libguile/frames.h (SCM_VALIDATE_VM_FRAME, scm_i_vm_frame_offset):
Remove.
* libguile/control.c (reify_partial_continuation): Once we know the
base_fp, relocate the dynamic stack.
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_relocate_prompts): New function.
(scm_dynstack_wind_prompt): Adapt to add new fp offset.
|
|
|
|
|
| |
* libguile/dynstack.c (push_dynstack_entry_unchecked): Reset top
dynstack tag to prevent garbage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/ports-internal.h (scm_port_buffer_can_take):
(scm_port_buffer_can_put): Add cur/end output arguments so that when a
caller asks the buffer room, it can be relative to a fixed point in
the buffer and not whatever point it's at when we go to fill it.
(scm_port_buffer_did_take, scm_port_buffer_did_put): Similarly,
require that the caller knows where they took/put data in the buffer.
Prevents overflow.
(scm_port_buffer_take_pointer, scm_port_buffer_put_pointer): Likewise,
require that the caller has already checked and knows a position in
the buffer and therefore how much data is available.
(scm_port_buffer_take, scm_port_buffer_put, scm_port_buffer_putback):
Adapt.
* libguile/ports.h (scm_fill_input): Add cur/avail output arguments.
* libguile/filesys.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/r6rs-ports.c:
* libguile/read.c:
* libguile/rw.c: Adapt all callers. Gnarly work!
|
|
|
|
| |
* libguile/vm-engine.c (BR_F64_ARITHMETIC): Fix type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_find_old_fluid_value): New
function.
* libguile/fluids.c (saved_dynamic_state_ref): New helper.
(scm_fluid_ref): Fix docstring.
(scm_fluid_ref_star): New function allowing access to previous values
for a fluid.
(scm_dynamic_state_ref): New internal function.
* libguile/fluids.h: Add scm_fluid_ref_star and scm_dynamic_state_ref.
* libguile/stacks.c (scm_stack_id): Adapt to %stacks not being a chain.
* libguile/throw.c (catch, throw_without_pre_unwind): Adapt to
%exception-handlers not being a chain.
* module/ice-9/boot-9.scm (catch, dispatch-exception): Instead of having
%exception-handlers be a chain, use fluid-ref* to access the chain
that is in place at the time the exception is thrown. Prevents
unintended undelimited capture of the current exception handler stack
by a delimited "catch".
(%start-stack): Similarly, don't be a chain.
* module/system/repl/debug.scm (frame->stack-vector):
* module/system/repl/error-handling.scm (call-with-error-handling):
* module/ice-9/save-stack.scm (save-stack): Adapt to %stacks not being a
chain.
* test-suite/tests/exceptions.test ("delimited exception handlers"): Add
tests.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add docs.
|
|
|
|
| |
* libguile/stime.c (scm_init_stime): Remove unused variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/vm-engine.c (BR_F64_ARITHMETIC): New preprocessor macro.
(br_if_f64_ee, br_if_f64_lt, br_if_f64_le, br_if_f64_gt, br_if_f64_ge):
New VM instructions.
* doc/ref/vm.texi ("Unboxed Floating-Point Arithmetic"): Document them.
* module/language/cps/compile-bytecode.scm (compile-function): Emit f64
comparison instructions.
* module/language/cps/effects-analysis.scm: Define effects for f64
primcalls.
* module/language/cps/primitives.scm (*branching-primcall-arities*): Add
arities for f64 primcalls.
* module/language/cps/specialize-numbers.scm (specialize-f64-comparison):
New procedure.
(specialize-operations): Specialize f64 comparisons.
* module/system/vm/assembler.scm (emit-br-if-f64-=, emit-br-if-f64-<)
(emit-br-if-f64-<=, emit-br-if-f64->, emit-br-if-f64->=): Export.
* module/system/vm/disassembler.scm (code-annotation): Add annotations
for f64 comparison instructions.
|
|
|
|
|
|
|
|
| |
* libguile/threads.c (struct launch_data): Add prev/next pointers.
(protected_launch_data, protected_launch_data_lock): New static vars.
(protect_launch_data, unprotect_launch_data): New functions.
(really_launch, scm_sys_call_with_new_thread): Preserve launch data
from GC. Thanks to Linas Vepstas for the report!
|