1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
Commit graph

19998 commits

Author SHA1 Message Date
Andy Wingo
d0a95bfbe8 Revert "Fix atomics usage in handle-interrupts JIT."
This reverts commit e8d34258be.
2019-05-27 18:40:41 +02:00
Andy Wingo
49fa49c42d Merge remote-tracking branch 'lightening/master' 2019-05-27 18:30:16 +02:00
Andy Wingo
84b9ef087b Add breakpoint instruction 2019-05-27 18:29:26 +02:00
Andy Wingo
09e4fc45c1 Merge remote-tracking branch 'lightening/master' 2019-05-27 13:53:09 +02:00
Andy Wingo
23bfbbaac1 Fix accidental change to ARMv7 ldr 2019-05-27 13:52:36 +02:00
Andy Wingo
e8d34258be Fix atomics usage in handle-interrupts JIT.
* libguile/jit.c (compile_handle_interrupts): Use atomics in
  handle-interrupts.
2019-05-27 12:08:58 +02:00
Andy Wingo
230a555976 Inline the atomic intrinsics
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (scm_bootstrap_intrinsics): Remove the atomic
  intrinsics, as the JIT no longer needs them.
* libguile/vm-engine.c (VM_NAME): Inline the intrinsics.
2019-05-27 12:01:38 +02:00
Andy Wingo
33e07fc56c Use new atomic instructions from lightening
* libguile/jit.c (compile_atomic_scm_ref_immediate):
(compile_atomic_scm_set_immediate):
(compile_atomic_scm_swap_immediate):
(compile_atomic_scm_compare_and_swap_immediate): Use lightening
instructions.
2019-05-27 11:57:36 +02:00
Andy Wingo
803e412f53 Merge remote-tracking branch 'lightening/master' 2019-05-27 11:34:39 +02:00
Andy Wingo
bcdde6656b Add atomic operations
These operations emit the same code that GCC does for corresponding
operations under the sequential consistency memory model.  It would be
possible to relax to acquire/release or something in the future.
2019-05-27 11:34:13 +02:00
Andy Wingo
909c0077cc Correctly handle overflow when emitting literal pools 2019-05-27 11:34:13 +02:00
Andy Wingo
d1c2d7de2f Switch to use atomic_compare_exchange_strong
* libguile/atomics-internal.h (scm_atomic_compare_and_swap_scm): Change
  to use same API as atomic-box-compare-and-swap!.
* libguile/intrinsics.c (atomic_compare_and_swap_scm): Remove loop, as
  we're using the strong variant now.
* libguile/async.c (scm_i_async_pop, scm_i_async_push): Adapt to new API
  of scm_atomic_compare_and_swap_scm.
2019-05-25 17:17:49 +02:00
Andy Wingo
8b8ce79e83 Bump version to 2.9.2
* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.
2019-05-23 21:05:21 +02:00
Andy Wingo
6880ced4c2 Reference Lightening instead of GNU Lightning
* doc/ref/vm.texi (Just-In-Time Native Code): Update with link to
  Lightening.
2019-05-23 21:00:20 +02:00
Andy Wingo
ee28c0680d Merge until 65d98d8fd from 'stable-2.2'
This marks stable-2.2 as merged up to 65d98d8fd, though the merge was
done via cherry-picks.
2019-05-23 20:47:01 +02:00
Mark H Weaver
b94c5f8e05 Update iconv.m4 from gnulib.
* m4/iconv.m4: Update from gnulib-v0.1-2176-ga79f2a287.
2019-05-23 17:51:52 +02:00
Mark H Weaver
bd50407d1f Strings, i18n: Limit the use of alloca to approximately 8 kilobytes.
* libguile/i18n.c (SCM_MAX_ALLOCA): New macro.
(SCM_STRING_TO_U32_BUF): Accept an additional variable to remember
whether we used malloc to allocate the buffer.  Use malloc if the
allocation size is greater than SCM_MAX_ALLOCA.
(SCM_CLEANUP_U32_BUF): New macro.
(compare_u32_strings, compare_u32_strings_ci, str_to_case): Adapt.
* libguile/strings.c (SCM_MAX_ALLOCA): New macro.
(normalize_str, unistring_escapes_to_r6rs_escapes): Use malloc if the
allocation size is greater than SCM_MAX_ALLOCA.
* test-suite/tests/i18n.test, test-suite/tests/strings.test: Add tests.
2019-05-23 17:51:36 +02:00
Mark H Weaver
2bfa4f73f1 put-u8: Always write a single byte, regardless of the port encoding.
Previously, 'put-u8' used textual I/O to write a single character,
relying on the usual practice of setting the port encoding to ISO-8859-1
for binary ports.

* libguile/r6rs-ports.c (scm_put_u8): Use 'scm_c_write', not 'scm_putc'.
2019-05-23 17:49:10 +02:00
Mark H Weaver
a3a726c868 Optimize fixnum exact integer square roots.
* libguile/numbers.c (scm_exact_integer_sqrt, scm_sqrt)
(exact_integer_is_perfect_square, exact_integer_floor_square_root):
Where it is trivial to do so, use GMP's low-level mpn functions to
avoid heap allocation.
2019-05-23 17:48:55 +02:00
Mark H Weaver
c6692a4825 Avoid 'with-latin1-locale' in binary I/O tests.
* test-suite/tests/r6rs-ports.test ("put-bytevector [2 args]")
("put-bytevector [3 args]", "put-bytevector [4 args]"): Set the default
port encoding instead of setting the locale.
2019-05-23 17:48:55 +02:00
Mark H Weaver
66ffd93dcf Fix indentation in scm_sum. 2019-05-23 17:48:55 +02:00
Mark H Weaver
506c70e72b Fix typo in comment. 2019-05-23 17:48:55 +02:00
Mark H Weaver
d5c420a888 Add 'scm_c_make_char' and use it where appropriate.
This reverts the change to SCM_MAKE_CHAR made in the previous commit
63818453ad, which used an arithmetic trick
to avoid evaluating its argument more than once.

Here, we restore the previous implementation of SCM_MAKE_CHAR, which
evaluates its argument twice.  Instead, we introduce a new inlinable
function 'scm_c_make_char' and replace uses of SCM_MAKE_CHAR with calls
to 'scm_c_make_char' where appropriate.

* libguile/chars.h (scm_c_make_char): New inline function.
* libguile/inline.c: Include chars.h.
* libguile/srfi-13.c (REF_IN_CHARSET, scm_string_any, scm_string_every)
(scm_string_trim, scm_string_trim_right, scm_string_trim_both)
(scm_string_index, scm_string_index_right, scm_string_skip)
(scm_string_skip_right, scm_string_count, string_titlecase_x)
(string_reverse_x, scm_string_fold, scm_string_fold_right)
(scm_string_for_each, scm_string_filter, scm_string_delete):
Use 'scm_c_make_char' instead of 'SCM_MAKE_CHAR' in cases where the
argument calls a function.
* libguile/chars.c (scm_char_upcase, scm_char_downcase, scm_char_titlecase),
libguile/ports.c (scm_port_decode_char),
libguile/print.c (scm_simple_format),
libguile/read.c (scm_read_character),
libguile/strings.c (scm_string_ref, scm_c_string_ref),
2019-05-23 17:48:46 +02:00
Mark H Weaver
7e208c8f25 Reimplement SCM_MAKE_CHAR to evaluate its argument only once.
The motivation for this change is that SCM_MAKE_CHAR is sometimes passed
an expression that involves a procedure call that is not always trivial.
In other cases, the results are not guaranteed to be the same both
times, which could lead to the creation of invalid SCM objects.

* libguile/chars.h (SCM_MAKE_CHAR): Reimplement.
2019-05-23 17:41:48 +02:00
Andrea Azzarone
fd4ba18bca Fix gc.test "after-gc-hook gets called" failures.
* libguile/scmsigs.c (signal_delivery_thread): Call scm_async_tick to
give any pending asyncs a chance to run before we block indefinitely
waiting for a signal to arrive.
2019-05-23 17:41:10 +02:00
Mark H Weaver
cca381ce17 Update user-visible copyright years.
* doc/ref/guile.texi: Update years in copyright notice.
* module/ice-9/command-line.scm (version-etc): Update 'copyright-year'.
* module/system/repl/common.scm (*version*): Update copyright years.
2019-05-23 17:40:59 +02:00
Mark H Weaver
980d8265c2 Avoid passing NULL to 'memcpy' and 'memcmp'.
Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/guile-devel/2019-03/msg00001.html>.

Note that C11 section 7.1.4 (Use of library functions) states that:
"unless explicitly stated otherwise in the detailed descriptions [of
library functions] that follow: If an argument to a function has an
invalid value (such as ... a null pointer ...) ..., the behavior is
undefined."  Note that 'strxfrm' is an example of a standard C function
that explicitly states otherwise, allowing NULL to be passed in the
first argument if the size argument is zero, but no similar allowance is
specified for 'memcpy' or 'memcmp'.

* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Call memcpy
only if 'byte_len' is non-zero.
* libguile/srfi-14.c (charsets_equal): Call memcmp only if the number of
ranges is non-zero.
* libguile/stime.c (setzone): Pass 1-character buffer to
'scm_to_locale_stringbuf', instead of NULL.
* libguile/strings.c (scm_to_locale_stringbuf): Call memcpy only if the
number of bytes to copy is non-zero.
2019-05-23 17:40:08 +02:00
Mark H Weaver
b38d9a1527 Fix typo in comment.
* module/ice-9/boot-9.scm: Fix typo.
2019-05-23 17:32:20 +02:00
Michael Gran
d4fd9adcac Disable test for current value of setitimer on Cygwin
* test-suite/tests/signals.test ("current itimers are 0"): throws unresolved
    for cygwin
2019-05-23 17:32:17 +02:00
Michael Gran
42bc255224 Make locale monetary conversion tests be less strict on terminal whitespace
* test-suite/tests/i18n.test (monetary-amount->locale-string): modified
2019-05-23 17:32:15 +02:00
Michael Gran
69bc964d7b Handle newlib C library's langinfo constant names
The newlib C library (used in Cygwin) has alternative names for
nl_langinfo GNU extensions

* configure.ac (_NL_NUMERIC_GROUPING): new test
* libguile/i18n.c (INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP)
   (MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, GROUPING, INT_FRAC_DIGITS)
   (FRAC_DIGITS, P_CS_PRECEDES, P_SEP_BY_SPACE, N_CS_PRECEDES, N_SEP_BY_SPACE)
   (P_SIGN_POSN, N_SIGN_POSN, INT_P_CS_PRECEDES, INT_P_SEP_BY_SPACE)
   (INT_N_CS_PRECEDES, INT_N_SEP_BY_SPACE, INT_P_SIGN_POSN, INT_N_SIGN_POSN)
   [HAVE_DECL__NL_NUMERIC_GROUPING]: map to newlib C constants, when present
2019-05-23 17:32:08 +02:00
Michael Gran
f169f64004 Add a fallback value for the locale-monetary-decimal-point
* module/ice-9/i18n.scm (locale-monetary-decimal-point): use "." as fallback
2019-05-23 17:31:23 +02:00
Mike Gran
a5df94e78c Fix binary output on files created by mkstemp!
Some operating systems require a O_BINARY flag.

* libguile/filesys.c (scm_i_mkstemp): Don't mask out O_BINARY flag
* test-suite/tests/posix.test ("binary mode honored"): new test
2019-05-23 17:30:33 +02:00
Mike Gran
08926cdcd0 Avoid leaking a file descriptor in test-unwind
* test-suite/standalone/test-unwind.c (check_ports): explicitly close temp file
2019-05-23 17:29:52 +02:00
Mike Gran
99dd8c9020 Fix strftime compile with null threads
* libguile/stime.c (scm_strftime): use correct pthread lock function
2019-05-23 17:16:54 +02:00
Mike Gran
8f254172ad Remove redefinition of when & unless in snarf-check-and-output-texi
* module/scripts/snarf-check-and-output-texi.scm (when, unless): removed
2019-05-23 17:16:30 +02:00
Mike Gran
9a7e66eceb Don't mutate read-only string in ports test
* test-suite/tests/ports.test ("valid wide mode string"): modified
2019-05-23 17:16:08 +02:00
Ludovic Courtès
abeeec74b2 Do not warn the user when 'madvise' returns ENOSYS.
* libguile/vm.c (return_unused_stack_to_os): Avoid 'perror' calls when
'madvise' returns ENOSYS.
2019-05-23 17:16:02 +02:00
Daniel Llorens
1b0fcddba5 Fix tests for SRFI-19 date->string ~N 2019-05-23 17:14:29 +02:00
Daniel Llorens
347ec3f088 Support ~N in SRFI-19 string->date
* module/srfi/srfi-19.scm (fractional-integer-reader,
  make-fractional-integer-reader): From reference implementation.
  (reader-directives): Handle #\N, from reference implementation.
* test-suite/tests/srfi-19: Add tests for string->date ~N.
* doc/ref/srfi-modules.texi (string->date): Add line for ~N.
2019-05-23 17:14:27 +02:00
Mark H Weaver
4f3aa81617 Update (ice-9 match) to include selected bug fixes from upstream.
Fixes <https://bugs.gnu.org/22925> and other bugs.

* module/ice-9/match.upstream.scm: Apply selected fixes from the
upstream match.scm in Chibi-Scheme.
* test-suite/tests/match.test.upstream: Add more tests from upstream.
2019-05-23 17:14:26 +02:00
Mark H Weaver
ba6e31e75f Fix spelling of ellipsis in (ice-9 match).
* module/ice-9/match.upstream.scm: Change several occurrences
of 'ellipse' and 'ellipses' to 'ellipsis', to more closely match
match.scm from Chibi-Scheme.
2019-05-23 17:14:24 +02:00
Mikael Djurfeldt
a83de07e35 Documentation fixes
* doc/ref/api-control:
* doc/ref/compiler.texi: Language fixes
* doc/ref/compiler ($kfun): Renamed argument clauses -> clause.
2019-05-23 17:14:21 +02:00
Mikael Djurfeldt
af1d55bcca Bootstrap optimization
* bootstrap/Makefile.am: Build both eval.go and psyntax-pp.go before
  the rest of the .go files so that they are handled by a fast macro
  expander. This saves time for a parallel build.
2019-05-23 17:13:19 +02:00
Mikael Djurfeldt
9c10b423a8 Add texinfo dependency to README
* README: Add texinfo dependency.
2019-05-23 17:13:15 +02:00
Mark H Weaver
f13e2cb8ad SRFI-19: Minor refactor of leap second table lookups.
* module/srfi/srfi-19.scm (leap-second-delta): Replace with ...
(utc->tai): ... this.
(leap-second-neg-delta): Replace with ...
(tai->utc): ... this.
(current-time-tai, priv:time-tai->time-utc!, priv:time-utc->time-tai!)
(time-tai->julian-day, time-monotonic->julian-day): Adapt accordingly.
2019-05-23 17:13:14 +02:00
Mark H Weaver
f9df551574 SRFI-19: time-utc->date: Support non-integer nanoseconds values.
* module/srfi/srfi-19.scm (time-utc->date): Use 'floor-remainder'
instead of 'modulo'.
2019-05-23 17:13:12 +02:00
Mark H Weaver
8e0dfaca19 SRFI-19: Check for incompatible types in time comparisons.
Fixes <https://bugs.gnu.org/26163>.
Reported by Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (time-compare-check): New procedure.
(time=?): Use 'time-compare-check' to check the arguments and raise an
error in case of mismatched types.  Previously, mismatched types would
cause time=? to return #f.
(time>?, time<?, time>=?, time<=?, time-difference!): Use
'time-compare-check' to check the arguments.
2019-05-23 17:13:11 +02:00
Mark H Weaver
0389c59bd4 SRFI-19: Fix normalization of seconds and nanoseconds in time records.
Fixes <https://bugs.gnu.org/26162>.
Reported by Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (time-normalize!): Rewrite.
* test-suite/tests/srfi-19.test: Add tests.
2019-05-23 17:13:09 +02:00
Mark H Weaver
8361d59d1c SRFI-19: Add a few more tests.
This is a followup to commit a58c7abd72.

* test-suite/tests/srfi-19.test: Add tests for large positive years.
2019-05-23 17:13:07 +02:00