summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2020-04-29Deprecate useless C bitvector interfaceAndy Wingo4-14/+32
C should use scm_c_bitvector_length, not scm_bitvector_length. * doc/ref/api-data.texi (Bit Vectors): Reorganize a bit to put typed C interfaces in their own section. * libguile/bitvectors.h: * libguile/bitvectors.c (bitvector-length, bitvector-count): Make SCM-flavored C interface private. (scm_c_bitvector_count): New function. * libguile/deprecated.c (scm_bitvector_length): Deprecate. (scm_bit_count): Adapt to changes.
2020-04-29bitvector-count-bits replaces bit-count*Andy Wingo4-98/+124
* NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_c_bitvector_count_bits): New function. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_count_star): Deprecate. * module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-count* with bitvector-count-bits. * test-suite/tests/bitvectors.test: Update.
2020-04-26'finalization_thread_proc' sets errno before calling 'perror'.Ludovic Courtès1-1/+2
* libguile/finalizers.c (finalization_thread_proc): Set 'errno' before calling 'perror'.
2020-04-18bitvector-flip-all-bits! replaces bit-invert!Andy Wingo4-31/+52
* NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_c_bitvector_flip_all_bits_x): New function. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_invert_x): Deprecate. * module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace bit-invert! with bitvector-flip-all-bits!. * module/system/vm/frame.scm (available-bindings): Use the new interface. * test-suite/tests/bitvectors.test: Update.
2020-04-15bitvector-set-all-bits! / bitvector-clear-all-bits! replace bitvector-fill!Andy Wingo4-43/+84
* NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_c_bitvector_set_all_bits_x) (scm_c_bitvector_clear_all_bits_x): New functions. * libguile/deprecated.h: * libguile/deprecated.c (scm_bitvector_fill_x): Deprecate. * module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace bitvector-fill! with bitvector-set-all-bits! / bitvector-clear-all-bits!. * module/system/vm/disassembler.scm (static-opcode-set): Use bitvector-set-bit!. * module/system/vm/frame.scm (available-bindings): Use the new interfaces. * test-suite/tests/bitvectors.test: Update.
2020-04-14bitvector-set-bit! / bitvector-clear-bit! replace bitvector-set!Andy Wingo6-42/+104
* NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/array-handle.h (bitvector_set_x, scm_array_get_handle): Adapt to bitvector changes. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_c_bitvector_set_bit_x) (scm_c_bitvector_clear_bit_x): New functions. * libguile/deprecated.h: * libguile/deprecated.c (scm_bitvector_set_x): Deprecate. * module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace bitvector-set! with bitvector-set-bit! / bitvector-clear-bit!. * module/system/vm/disassembler.scm (static-opcode-set): Use bitvector-set-bit!. * module/system/vm/frame.scm (compute-defs-by-slot, available-bindings): Use bitvector-set-bit!. * test-suite/tests/bitvectors.test: Update.
2020-04-14bitvector-bit-set? / bitvector-bit-clear? replace bitvector-refAndy Wingo5-38/+80
This is an opportunity to make a new interface that can be more efficient in 3.0 (because no generic array support), easier to read (no need for 'not'), and more consistent with other bitvector interfaces. * NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/array-handle.h (bitvector_ref, scm_array_get_handle): Adapt to bitvector changes. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_c_bitvector_bit_is_set) (scm_c_bitvector_bit_is_clear): New functions. * libguile/deprecated.h: * libguile/deprecated.c (scm_bitvector_ref): Deprecate. * module/ice-9/sandbox.scm (bitvector-bindings): Replace bitvector-ref with bitvector-bit-set? / bitvector-bit-clear?. * module/system/vm/disassembler.scm (instruction-has-fallthrough): Use bitvector-bit-clear?. * test-suite/tests/bitvectors.test: Update.
2020-04-13Replace bit-set*! with bitvector-set-bits! / bitvector-clear-bits!Andy Wingo4-104/+153
The old name was wonky and hard to read: you almost always pass a literal as the value to set, so better to make separate functions. * NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_bitvector_set_bits_x) (scm_bitvector_clear_bits_x): New functions. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_set_star_x): Deprecate. * module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace bit-set*! with bitvector-set-bits! / bitvector-clear-bits!. * module/system/vm/frame.scm (available-bindings, compute-killv): Use bitvector-set-bits! and bitvector-clear-bits!. * test-suite/tests/bitvectors.test: Update.
2020-04-12Replace bit-position with bitvector-positionAndy Wingo4-58/+76
The old name was wonky and had bad argument order. * NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (scm_bitvector_position): New function. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_position): Deprecate. * module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-position with bitvector-position. * module/language/cps/intset.scm (bitvector->intset): Use bitvector-position. * module/system/vm/frame.scm (available-bindings): Use bitvector-position. * test-suite/tests/bitvectors.test ("bitvector-position"): Add test.
2020-04-12Replace bit-count with bitvector-countAndy Wingo4-39/+63
The old name was wonky and had bad argument order. * NEWS: Add entry. * doc/ref/api-data.texi (Bit Vectors): Update. * libguile/bitvectors.h: * libguile/bitvectors.c (VALIDATE_BITVECTOR): New helper. (scm_bitvector_count): New function. * libguile/deprecated.h: * libguile/deprecated.c (scm_bit_count): Deprecate. * module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-count with bitvector-count. * module/srfi/srfi-60.scm: No need to #:replace bit-count. * module/system/vm/frame.scm (available-bindings): Use bitvector-count. * test-suite/tests/bitvectors.test ("bitvector-count"): Add test.
2020-04-12Deprecate bitvector-ref on array slicesAndy Wingo4-292/+337
* NEWS: Update. * doc/ref/api-data.texi (Bit Vectors): Update documentation on bit-set*! and bit-count*. * libguile/bitvectors.c: Add a to-do list. (scm_c_bitvector_ref, scm_c_bitvector_set_x, scm_bitvector_fill_x) (scm_bitvector_to_list, scm_bit_count, scm_bit_position): Issue deprecation warnings when used on array slices. (scm_list_to_bitvector): Simplify. (scm_bit_set_star_x, scm_bit_count_star): Deprecate arrays as target bitvectors, and also use of u32vector as selection vector. * libguile/bitvectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_istr2bve): Deprecate. * test-suite/tests/bitvectors.test ("bit-count*"): Remove test of u32 selectors.
2020-03-26Update SRFI-14 tables to Unicode 13.0.0Mike Gran1-505/+1333
* libguile/srfi-14.i.c (cs_lower_case_ranges, cs_upper_case_ranges) (cs_letter_ranges, cs_digit_ranges, cs_letter_plus_digit_ranges) (cs_graphic_ranges, cs_printing_ranges, cs_punctuation_ranges) (cs_symbol_ranges, cs_designated_ranges): updated to Unicode 13
2020-03-23'resize_set' no longer allocates in a loop.Ludovic Courtès1-2/+2
* libguile/weak-set.c (resize_set): Call 'scm_gc_malloc_pointerless' outside the loop.
2020-03-23Ensure weak sets are occasionally vacuumed.Ludovic Courtès1-0/+1
Just like in dc8dda77e0c937abae42a76ea88c6e7995adbd9a, this ensures weak sets are vacuumed in a timely fashion. It also works around the fact that 'vacuum_all_weak_tables' isn't getting called more than a couple of times, for some reason. Partly fixes <https://bugs.gnu.org/40194>. * libguile/weak-set.c (weak_set_add_x): When 'set->items > set->upper', call 'vacuum_weak_set'.
2020-03-23Avoid double initialization in 'vector-copy'.Ludovic Courtès1-4/+8
* libguile/vectors.c (make_vector): New function. (scm_c_make_vector): Use it instead of 'scm_words'. (scm_vector_copy): Use it instead of 'scm_c_make_vector'.
2020-03-22Deprecate 'tmpnam' and add '--disable-tmpnam' configure option.Matt Wette1-0/+11
* configure.ac: Add '--disable-tmpnam'. * libguile/posix.c (tmpnam): Conditionalize on 'SCM_ENABLE_DEPRECATED' and 'ENABLE_TMPNAM'. Call 'scm_c_issue_deprecation_warning'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-03-22Interpret dynamic library name as literal file name first.Isaac Jurado1-4/+3
Fixes <https://bugs.gnu.org/21076>. * libguile/dynl.c (sysdep_dyn_link): Try plain lt_dlopen first, to interpret fname as a literal path. * doc/ref/api-foreign.texi: Update explanation to describe the new behavior. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2020-03-21Fix compilation --without-threads.Matt Wette2-0/+4
Fixes <https://bugs.gnu.org/40075>. Reported by Thomas Klausner <tk@giga.or.at>. * libguile/null-threads.h: Include "libguile/scm.h". * libguile/null-threads.c: Include "libguile/scmconfig.h". Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-03-17Fix race condition between 'abort-to-prompt' and stack marking.Ludovic Courtès1-2/+10
Fixes <https://bugs.gnu.org/28211>. * libguile/vm.c (scm_i_vm_emergency_abort, abort_to_prompt): Move 'vp->fp' assignment above 'sp[nargs]' assignments.
2020-03-17gdb: Avoid accessing values that are optimized out.Ludovic Courtès1-0/+1
* libguile/libguile-3.0-gdb.scm (vm-frame-function-name)[ip-in-symbol?]: Do not access SYM's value when it's optimized out.
2020-03-17gdb: Adjust 'find-vp' for Guile 3.0.Ludovic Courtès1-5/+6
* libguile/libguile-3.0-gdb.scm (find-vp): Adjust for Guile 3.0.
2020-03-17gdb: Use <stdint.h> types.Ludovic Courtès1-2/+2
* libguile/libguile-3.0-gdb.scm (vm-frame): Look up stdint.h types instead of now-deprecated "scm_t_" types.
2020-03-17gdb: Delay type lookups.Ludovic Courtès1-8/+9
This avoids errors while loading the file when types are not in scope. * libguile/libguile-3.0-gdb.scm (%gdb-memory-backend)[void*]: Turn into a promise and adjust user accordingly. (ip-type, fp-type, sp-type, uint-type): Remove. (vm-frame)[ip-type, uint-type]: New variables.
2020-03-09Fix incorrect allocation size in 'make-vtable-vtable'.Ludovic Courtès1-3/+5
Fixes <https://bugs.gnu.org/39266>. Thanks to <https://rr-project.org/> for its help! * libguile/struct.c (set_vtable_access_fields): Fix first argument to 'scm_gc_malloc_pointerless'.
2020-03-06'hash' behaves like 'hashq' for tc7s without an 'equal?' implementation.Ludovic Courtès1-1/+17
Fixes <https://bugs.gnu.org/39634>. * libguile/hash.c (scm_raw_ihash): Add cases for scm_tc7 values that were not explicitly listed.
2020-02-26Add support for perf map creationAndy Wingo1-0/+25
* libguile/jit.c (create_perf_map_once, create_perf_map, perf_map): New locals. (compute_mcode): Add an entry to perf_map for emitted JIT code.
2020-02-21Implement hashing for keywords, i.e. (hash #:x ...)Rob Browning2-0/+5
Add keyword handling to (hash ...). Previously it would just return the same value for all keywords. * libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case. * libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro.
2020-02-19Fix bug restoring a JIT continuation from the interpreterAndy Wingo1-0/+11
* libguile/vm.c (push_interrupt_frame, compose_continuation): In places where we push on synthetic frames before possibly going back to mcode, make sure that the return mcode will trampoline back to the interpreter. Fixes compose-continuation from the interpreter to partial continuations with mcode.
2020-02-19Better debugging in jit.cAndy Wingo1-9/+36
* libguile/jit.c (emit_direct_tail_call): Assert self-tail call has mcode. (opcodes_seen, bitvector_ref, bitvector_set, compile1): Make the opcodes_seen set more compact, and log all instruction emissions at level 3. (compute_mcode): Don't overwrite mcode if compilation fails.
2020-02-17Merge remote-tracking branch 'lightening/master'Andy Wingo1-0/+4
2020-02-11Reintroduce 'SCM_MEMORY_ERROR' in terms of 'scm_report_out_of_memory'.Ludovic Courtès1-1/+3
Suggested by Dale P. Smith <dsmich@roadrunner.com>. * libguile/deprecated.h (SCM_MEMORY_ERROR): New macro. * doc/ref/api-control.texi (Dynamic Wind): Use 'scm_report_out_of_memory'.
2020-02-10Remove traces of 'scm_memory_error'.Ludovic Courtès1-3/+1
'scm_memory_error' was deprecated in 2014 in commit c2247b782a9234bb9aedee5204c30daf1d01a510 and removed in 2017 in commit c248ea10beb2afa4c113dbc6dc707bed5dbfc92e. This is a followup. * libguile/error.h (SCM_MEMORY_ERROR): Remove. * doc/guile-api.alist: Remove 'scm_memory_error'. * doc/ref/api-control.texi (Handling Errors): Likewise. (Dynamic Wind): Use 'scm_misc_error' instead of 'scm_memory_error'.
2020-02-08Fix build on ia64.John Paul Adrian Glaubitz2-3/+8
* libguile/continuations.c (capture_auxiliary_stack): Fix logic in preprocessor code when checking for ia64 host; fix dereferencing of ctx variable. * libguile/threads.h (struct scm_thread): Add missing member SCM_STACKITEM *auxiliary_stack_base. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-02-08Fix build on platforms where the stack grows upwards.John Paul Adrian Glaubitz1-1/+1
* libguile/continuations.c (scm_dynthrow): Fix missing mra parameter to grow_stack for SCM_STACK_GROWS_UP. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-02-08Handle GMP allocations through libgc and remove bignum finalizers.Ludovic Courtès1-7/+12
This significantly speeds up loads that create lots of bignums, like (language cps slot-allocation) for files with many top-level definitions. Compiling such a file is typically 2.5 times faster. See <https://lists.gnu.org/archive/html/guile-devel/2020-02/msg00023.html>. * libguile/numbers.c (custom_gmp_malloc): Use 'scm_gc_malloc_pointerless' instead of 'scm_malloc'. (custom_gmp_realloc): Use 'scm_gc_realloc'. (custom_gmp_free): Remove call to 'free'. (make_bignum): Use 'scm_gc_malloc' instead of 'scm_gc_malloc_pointerless'. Call 'scm_i_set_finalizer' only when SCM_INSTALL_GMP_MEMORY_FUNCTIONS is false.
2020-01-21build: Actually install libguile-3.0-gdb.scm.Ludovic Courtès2-4/+4
Reported by brandelune on #guile. * libguile/libguile-2.2-gdb.scm: Rename to... * libguile/libguile-3.0-gdb.scm: ... this. * libguile/Makefile.am (install-data-hook): Replace hard-coded "2.2" with @GUILE_EFFECTIVE_VERSION@.
2020-01-20Make 'scm_sym_lambda', 'scm_sym_quote', etc. public again.Ludovic Courtès1-1/+2
Fixes <https://bugs.gnu.org/39183>. These symbols had been inadvertently removed from libguile, even though they were intended to be public (as they were in 2.2). * libguile/expand.c: Include "memoize.h".
2020-01-13Bump objcode minor version in preparation for new stable seriesAndy Wingo1-3/+3
* libguile/loader.h (SCM_OBJCODE_MINIMUM_MINOR_VERSION): (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
2020-01-12Respect thread local fluid defaultsRob Browning1-14/+9
Previously (fluid-ref (make-thread-local-fluid #t)) would return #f via scm_fluid_ref because the internal scm_hashq_ref would return #f when the fluid had not been set, and that was interpreted as an actual value for the fluid. Instead, just pass the fluid default as the default for the hash table lookups so that we don't need a second step to determine if the fluid was set. Thanks to Andrew Gierth for tracking down the problem.
2020-01-11Fix build on 32-bit systems with JIT supportAndy Wingo2-1/+10
* libguile/intrinsics.h: Add s64->f64 intrinsic, for 32-bit targets. * libguile/jit.c (compile_s64_to_f64): Call the intrinsic for 32-bit targets.
2020-01-06Merge remote-tracking branch 'lightening/master'Andy Wingo1-1/+5
2020-01-03Extend core vector-fill! to handle a rangeDaniel Llorens1-12/+33
With this patch, these two lines (vector-fill! vec fill) (vector-fill! vec fill 0 end) run at the same speed; before, the second one was much slower. This patch also makes it an error to call vector-fill! with a non-vector array. The previous implementation did not work correctly in this case. * libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): Better error message. (vector-fill!): Handle optional arguments start, end. Do not attempt to handle non-vector arrays. Rename the C binding to scm_vector_fill_partial_x. (scm_vector_fill_x): Reuse scm_vector_fill_partial_x. * module/srfi/srfi-43.scm (vector-fill!): Remove & re-export the core version instead.
2020-01-03Provide SCM_DEFINE_STATICDaniel Llorens1-1/+11
From guile-gnome:plain/glib/gnome/gobject/private.h. * libguile/gsubr.h (SCM_DEFINE_STATIC): As stated.
2020-01-02Fix abort_to_prompt bug if dynwind leave thunk expands the stackAndy Wingo1-5/+8
* libguile/vm.c (scm_i_vm_emergency_abort, abort_to_prompt): Unwinding the dynwind stack can run dynwind leave thunks, which may expand the stack, which may invalidate previously calculated SP / FP values. (Re)calculate SP/FP after unwinding, to avoid writing to unmapped memory. Fixes compile errors seen on Ubuntu and some other ports.
2019-12-13Avoid throwing exceptions during early boot if stdin is closedAndy Wingo3-56/+38
* libguile/fports.c (scm_i_fdes_is_valid): New internal helper. (scm_i_fdes_to_port): Use new helper. * libguile/fports.h: Declare new helper. * libguile/init.c (scm_standard_stream_to_port): Refactor to use scm_i_fdes_is_valid.
2019-12-11Merge remote-tracking branch 'origin/stable-2.2'Andy Wingo2-14/+19
2019-12-10Move less? slow path out of lineAndy Wingo1-32/+31
* libguile/jit.c (compile_less, compile_less_slow): Move slow path out of line.
2019-12-10Add fixnum fast-path for =Andy Wingo1-6/+29
* libguile/jit.c (compile_numerically_equal): Add fixnum fast-path. (compile_numerically_equal_slow): New slow path.
2019-12-10Move allocate-pointerless-words/immediate slow path out of lineAndy Wingo1-12/+19
* libguile/jit.c (compile_allocate_pointerless_words_immediate) (compile_allocate_pointerless_words_immediate_slow): Move slow path out of line.
2019-12-10Move allocate-words/immediate slow path out of lineAndy Wingo1-12/+19
* libguile/jit.c (compile_allocate_words_immediate) (compile_allocate_words_immediate_slow): Move slow path out of line.