1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 23:40:29 +02:00
Commit graph

20966 commits

Author SHA1 Message Date
Ludovic Courtès
7e048c6c51 Update NEWS.
* NEWS: Update.
2022-06-16 10:06:32 +02:00
Jessica Tallon
4456245753 Add missing #:modules argument for coverage-data->lcov.
The code coverage function `coverage-data->lcov` has a documented
`modules` argument, however that was missing from the source. I have
added it so when supplied it only converts the coverage data for the
supplied modules. If not supplied it defaults the old behavour of
including all the modules currently loaded.

* module/system/vm/coverage.scm (coverage-data->lcov): Add #:modules
parameter and honor it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 10:01:06 +02:00
Liliana Marie Prikler
01b686b701 Allow null bytes in UNIX sockets.
The current socket address constructors all assume, that there are no
null bytes in the socket path.  This assumption does not hold in Linux,
which uses an initial null byte to demarcate abstract sockets and
ignores all further null bytes [1].

[1] https://www.man7.org/linux/man-pages/man7/unix.7.html

* libguile/sockets.c (scm_fill_sockaddr)[HAVE_UNIX_DOMAIN_SOCKETS]:
Use scm_to_locale_stringn to construct c_address.
Use memcpy instead of strcpy and calculate size directly instead of
using SUN_LEN.
(_scm_from_sockaddr): Copy the entire path up to the limits imposed by
addr_size.
* test-suite/tests/00-socket.test: ("make-socket-address"): Add case for
abstract unix sockets.
("AF_UNIX/SOCK_STREAM"): Add abstract socket versions of bind, listen,
connect and accept.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 09:54:29 +02:00
Taylor R Campbell
e4e8afd6c8 Allow empty vendor string in GNU target triplets.
NetBSD and pkgsrc have been using an empty vendor string since the
mid-'90s, such as x86_64--netbsd.  pkgsrc has been carrying around a
workaround just the guile build for a long time.  (Before that,
NetBSD omitted the vendor altogether, so if x86_64 existed then it
might have been `x86_64-netbsd', but that caused more problems.)
This change makes Guile accept an empty vendor string so workarounds
are no longer necessary.

* module/system/base/target.scm (validate-target): Allow empty vendor
string in GNU target triplets.
* test-suite/tests/cross-compilation.test ("cross-compilation"): Add
tests for "x86_64--netbsd".

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 09:42:05 +02:00
Mihail Iosilevich
158da6966b Allow (library ...) form in cond-expand inside R7RS define-library.
Guile (3.0.8) reports a compilation error when cond-expand tries to
check existence of a missing library:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (scheme sort))
                             (import (scheme sort)))))
    While compiling expression:
    no code for module (scheme sort)

It looks like bug #40252 was not fully eliminated.

Also, (library ...) cannot handle module names like (srfi 1), though
(import (srfi 1)) works fine. For example, this code fails:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (srfi 1))
                             (import (srfi 1)))))
    While compiling expression:
    In procedure symbol->string: Wrong type argument in position 1
    (expecting symbol): 1

There are probably other cases when (library ...) and (import ...) does
not work identically: (library ...) uses resolve-interface while
(import ...) uses resolve-r6rs-interface.

This patch fixes both issues.

* module/ice-9/r7rs-libraries.scm (define-library): Replace
'resolve-interface' call by 'resolve-r6rs-interface', wrapped in
'cond-expand'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 09:36:31 +02:00
Ludovic Courtès
e8a41aee29 'module-define!' honors the 'module' parameter.
* module/ice-9/boot-9.scm (module-define!): In 'module-add!' call, pass
MODULE rather than (current-module).
2022-06-16 09:31:36 +02:00
Ludovic Courtès
64449a835a 'connect' handles EAGAIN like EINPROGRESS.
* libguile/socket.c (scm_connect): Handle EAGAIN the same way as
EINPROGRESS (connect(2) returns EAGAIN for Unix-domain sockets and
socketpairs).
2022-06-16 09:31:36 +02:00
Mikael Djurfeldt
cc45597681 Find unidata_to_charset.awk from commit 9f8e05e5 in $(srcdir).
* libguile/Makefile.am: Find unidata_to_charset.awk in $(srcdir) in
order to support building in a separate directory.
2022-04-08 15:35:34 +02:00
Ludovic Courtès
4468427334 Update NEWS.
* NEWS: Mention srfi-14.i.c built from source.
2022-03-24 14:34:18 +01:00
Timothy Sample
9f8e05e513 Create 'srfi-14.i.c' during build.
* libguile/srfi-14.i.c: Delete file.
* libguile/UnicodeData.txt: New file.
* libguile/unidata_to_charset.awk: Skip comments.
* libguile/Makefile.am (EXTRA_DIST): Add 'UnicodeData.txt'.
(srfi-14.i.c): New rule.
(noinst_HEADERS): Remove 'srfi-14.i.c'.
(BUILT_INCLUDES, CLEANFILES): Add 'srfi-14.i.c'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-24 14:28:46 +01:00
Timothy Sample
63886aeda2 Reimplement 'unidata_to_charset.pl' in Awk.
* libguile/unidata_to_charset.pl: Delete file.
* libguile/unidata_to_charset.awk: New file.
* libguile/Makefile.am (EXTRA_DIST): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-24 14:28:46 +01:00
Rob Browning
6e82a4516a Fix "non-revealed port is closed" ports.test
Don't close the test port's file descriptor because the port still has a
reference to it, and could still close it at any time when finally
garbage collected.  This did soemetimes break subsequent tests.

Bug: https://debbugs.gnu.org/43521
2022-03-16 22:23:37 -05:00
Ludovic Courtès
f18f670223 tests: web-server: Wait until the server is listening.
Fixes synchronization issues observed on slow or loaded machines, where
client connection attempts would fail with ECONNREFUSED:

  https://issues.guix.gnu.org/54348

* test-suite/tests/web-server.test ("server is listening"): New test.
2022-03-15 14:38:40 +01:00
Sergei Trofimovich
f047133e7b build: Test '-flto' on both compiler and linker.
Before the change ./configure incorrectly enabled -flto on toolchains
that support -flto on compiler side but don't support -flto on linker
side. This caused incorrect type size detection on nixpkgs' Darwin:

 configure:54594: checking size of size_t
 configure:54600: clang -std=gnu11 -o conftest -g -O2 -flto   conftest.c  >&5
 ld: warning: ignoring file /private/tmp/nix-build-guile-3.0.8.drv-0/conftest-00e93d.o,
   building for macOS-x86_64 but attempting to link with file built
   for unknown-unsupported file format ( 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00 0x14 0x00 0x00 0x00 0x80 0x1A 0x00 0x00 )
 Undefined symbols for architecture x86_64:
   "_main", referenced from:
      implicit entry/start for main executable
 ld: symbol(s) not found for architecture x86_64
 clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Taken from https://github.com/NixOS/nixpkgs/pull/160051#issuecomment-1046105041

The change makes sure -flto support tests basic support of just for
object file generation but for linker as well.

* configure.ac: use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-07 10:54:16 +01:00
Ludovic Courtès
347321ece9 psyntax: Honor source properties for things other than syntax objects.
Commit 54bbe0b284 inadvertently led
psyntax to dismiss source location info for data returned by read hash
extensions, because read hash extensions return plain data with
associated source properties, even when called from 'read-syntax'.

This change reverts part of this commit to restore that behavior.

Fixes <https://issues.guix.gnu.org/54003>.

* module/ice-9/psyntax.scm (datum-sourcev): New procedure.
(source-annotation): Fall back to 'datum-sourcev'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/compiler.test ("psyntax")["syntax-source with
read-hash-extend"]: New test.
2022-03-07 10:52:16 +01:00
Ludovic Courtès
c572b11f3d tests: Add read-syntax + syntax-source test.
* test-suite/tests/reader.test ("read-syntax")["syntax-source"]: New
test.
2022-03-07 10:52:16 +01:00
Ludovic Courtès
a1a1400c7c Update NEWS.
* NEWS: Add 3.0.9 section.
2022-03-07 10:52:16 +01:00
Ludovic Courtès
24b30130ca build: When cross-compiling, get type sizes of the target system.
Fixes <https://issues.guix.gnu.org/54198>.

As noted in the comment at the top, 'SIZEOF_TYPE' must be used instead
of 'sizeof (TYPE)' to support cross-compilation.

The regression was introduced in
5e5afde06f but only became apparent with
717e787da6.

* libguile/gen-scmconfig.c (main): Replace uses of 'sizeof' by
references to the SIZEOF_* macros.
* configure.ac: Add 'AC_CHECK_SIZEOF' call for 'intmax_t'.
2022-02-28 23:00:46 +01:00
Vijay Marupudi
68aeffe8dd Typo fix: Use correct variable name in example
* doc/ref/api-control.texi
2022-02-23 09:45:17 +01:00
Andy Wingo
5a3086e681 Bump user-visible copyright years to 2022
* module/ice-9/command-line.scm (version-etc):
* module/system/repl/common.scm (*version*): Bump to 2022.
2022-02-11 15:21:03 +01:00
Andy Wingo
e734a6a607 Exclude ChangeLog from assert-no-store-file-names distcheck rule
* Makefile.am (assert-no-store-file-names): Remove ChangeLog.
2022-02-10 21:40:43 +01:00
Andy Wingo
5319fd38e2 GNU Guile v3.0.8
* GUILE-VERSION (GUILE_MICRO_VERSION, LIBGUILE_INTERFACE_CURRENT):
(LIBGUILE_INTERFACE_AGE): Bump.
2022-02-10 20:55:23 +01:00
Andy Wingo
3d69993295 Minor NEWS tweaks
* NEWS: Minor tweaks.
2022-02-10 20:54:16 +01:00
Mikael Djurfeldt
27b86a6f32 Align argument type of scm_to_wchar with its declaration.
* libguile/numbers.c (scm_from_wchar): Change argument type from wchar_t
to scm_t_wchar which is the argument type in numbers.h.
2022-02-10 12:41:59 +01:00
Mikael Djurfeldt
2e10a1257f Align return type of scm_to_wchar with its declaration.
* libguile/numbers.c (scm_t_wchar): Change return type from wchar_t to
scm_t_wchar which is the return type in numbers.h.
2022-02-10 12:36:06 +01:00
Ludovic Courtès
2aed3c117c psyntax: Pass source vectors to tree-il constructors.
Avoiding systematic conversion from source vectors to property alists
saves 20% on the final heap size of a process doing:

  (compile-file FILE #:optimization-level 1)

where FILE is large.

* module/language/tree-il.scm (tree-il-src/ensure-alist): New procedure
with setter.  Export as 'tree-il-src'.
* module/ice-9/psyntax.scm (build-void, build-call)
(build-conditional, build-lexical-reference, build-lexical-assignment)
(build-global-reference, build-global-assignment)
(build-global-definition, build-simple-lambda, build-case-lambda)
(build-lambda-case, build-primcall, build-primref)
(build-data, build-sequence, build-let, build-named-let)
(build-letrec, expand-body): Remove (sourcev->alist src) calls.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): Use
'tree-il-src' instead of accessing the 'src' slot directly.
* module/system/vm/assembler.scm (link-debug): Adjust so PC can be
followed by a vector or an alist.
2022-02-07 12:23:35 +01:00
Ludovic Courtès
032acdeac9 'string->symbol' avoids copying the underlying string.
* libguile/strings.c (scm_i_make_symbol): Reuse NAME's stringbuf unless
it's mutable or NAME starts at a non-zero offset or has a different
length.
2022-02-07 12:23:35 +01:00
Andy Wingo
2f9bc7fe61 Update unicode tables to Unicode 14.0.0; initial charsets immutable
* libguile/srfi-14.i.c: Update from Unicode 14.0.0.
* libguile/unidata_to_charset.pl (compute): Write arrays as static const
data, to avoid polluting the namespace and to avoid adding these to the
GC root set.
* libguile/srfi-14.c (SCM_CODEPOINT_F_IMMUTABLE): New flag.
(scm_charset_is_immutable): New internal predicate.
(SCM_VALIDATE_MUTABLE_CHARSET): New internal validator.
(cs_full_ranges, cs_full_ranges_len): Re-express as separate ranges and
len, because the ranges pointer in scm_t_char_set is mutable.
(scm_char_set_unfold_x, scm_list_to_char_set_x)
(scm_string_to_char_set_x, scm_char_set_filter_x)
(scm_i_ucs_range_to_char_set, scm_char_set_adjoin_x)
(scm_char_set_delete_x, scm_char_set_complement_x)
(scm_char_set_unfold_x, scm_char_set_intersection_x)
(scm_char_set_difference_x, scm_char_set_xor_x): Require mutable
charsets.
(define_charset): Add immutable flag.
(scm_init_srfi_14): Adapt initial charset definitions.
2022-02-06 21:17:24 +01:00
Andy Wingo
7e3470343a NEWS fixup
* NEWS: Remove duplicate word.
2022-02-06 20:18:19 +01:00
Ludovic Courtès
8e2e2ceb17 Deprecate symbol properties.
* libguile/strings.c (scm_i_make_symbol): Remove 'props' argument.  Use
3 words instead of 'scm_double_cell'.
* libguile/strings.h: Adjust accordingly.
* libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol):
Likewise.
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x,
scm_symbol_pset_x): Move to...
* libguile/deprecated.c: ... here.  Rewrite in terms of object
properties.
(symbol_function_slot, symbol_property_slot): New variables.
* libguile/symbols.h (SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC)
(SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS)
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x)
(scm_symbol_pset_x): Move to...
* libguile/deprecated.h: ... here.  Mark declarations as 'SCM_DEPRECATED'.
* module/system/base/types.scm (cell->object): Remove 'props' field for
%TC7-SYMBOL.
* doc/ref/api-data.texi (Symbol Props): Remove.
* NEWS: Update.
2022-02-04 11:12:28 +01:00
Ludovic Courtès
2ebf039707 Remove unused 'scm_i_c_make_symbol'.
* libguile/strings.c (scm_i_c_make_symbol): Remove.
* libguile/strings.h (scm_i_c_make_symbol): Remove declaration.
2022-02-03 23:23:59 +01:00
Andy Wingo
4e92f1d7cc Update NEWS
* NEWS: Update.
2022-02-02 20:53:46 +01:00
Andy Wingo
62fc44e6ee Slight bignum-fixnum multiplication optimization
* libguile/integers.c (scm_integer_mul_zi): Use mpn_mul_1.
2022-02-01 19:57:14 +01:00
Andy Wingo
54bbe0b284 Avoid source properties in psyntax
* module/ice-9/psyntax.scm (source-annotation): Only return source
properties from syntax objects.
(source-wrap): Don't look for source properties.
(expand-macro): Rebuild source properties on macro output via
source-wrap, not source properties.  Only annotate head of a chain of
pairs.
(strip): Here's the only use of set-source-properties!: when stripping
a syntax object to a datum.
(macroexpand): If the input expression is not a syntax object, eagerly
extract its source properties.
(datum->syntax): Fix case in which source is given as an alist.
* module/ice-9/psyntax-pp.scm: Regenerate.
2022-02-01 18:26:41 +01:00
Andy Wingo
e933282f2b Prebuild fewer files
* prebuilt/i686-pc-linux-gnu/Makefile.am:
* prebuilt/mips-unknown-linux-gnu/Makefile.am:
* prebuilt/x86_64-unknown-linux-gnu/Makefile.am: Only prebuild eval.go,
psyntax-pp.go, and boot-9.go.  The builder can handle the rest.
Otherwise the tarball size would explode, given the expansion in
bootstrap.am.
2022-02-01 14:50:44 +01:00
Andy Wingo
9654ab1f21 Fix reproducibility for inlinable-exports
* module/language/tree-il/inlinable-exports.scm (compute-decoder): Map
items in order of their code.
2022-02-01 14:50:44 +01:00
Andy Wingo
9b9149a5bf Rework bootstrap to be reproducible
* configure.ac:
* Makefile.am (SUBDIRS): Replace bootstrap/ with stage0, stage1, and
stage2.
* am/bootstrap.am: Include all files and all rules.
* meta/build-env.in (GUILE_AUTO_COMPILE): Always turn off
auto-compilation.  Take a GUILE_BOOTSTRAP_STAGE argument, which can be
stage0, stage1, stage2, or unset.  Adapt the load-compiled path
accordingly.
* meta/uninstalled-env.in: Include .go files from stage2.
* module/Makefile.am: Rework to use boostrap.am.
* module/system/base/optimize.scm (available-optimizations): Punt the
inlinable-exports machinery to -O2.
* stage0/Makefile.am:
* stage1/Makefile.am:
* stage2/Makefile.am: New files.
2022-02-01 14:50:40 +01:00
Andy Wingo
6ed66f42cb Add -ftlo support
* configure.ac: Check if the compiler supports link-time optimization.
If it does, turn it on.  Saves around 15% off libguile binary size.
Controllable via --enable-lto configure option.
2022-01-29 15:49:43 +01:00
Andy Wingo
373f35b5f7 peval cross-module-inlining gracefully handles missing interface
* module/language/tree-il/peval.scm (peval): The intention was for
resolve-interface to return an interface only if it exists, but actually
it throws if the interface isn't know.  Fix to do what we intended to
do.
2022-01-17 21:25:08 +01:00
Andy Wingo
d01ab7bf5c Fix inlinable-exports bug for pure modules
* module/language/tree-il/inlinable-exports.scm (compute-decoder): Fix
bug in which inlinable exports in a pure module would have a missing
make-struct/no-tail binding.
2022-01-17 21:07:22 +01:00
Andy Wingo
222b320868 Remove dead code in scm_integer_inexact_sqrt_z
* libguile/integers.c (scm_integer_inexact_sqrt_z): Remove some dead
code.
2022-01-13 09:37:17 +01:00
Daniel Llorens
19bc021e34 Have log and log10(real nan) return real nan regardless of sign
* libguile/numbers.c (log_of_shifted_double, scm_log10): Avoid complex
  extension when the argument is a real nan.
* test-suite/tests/numbers.test: Tests for nans of either sign.
2022-01-13 09:37:17 +01:00
Daniel Llorens
4feff820be Don't use HAVE_COPYSIGN in libguile/numbers.c
* libguile/numbers.c (icmplx2str): As stated. copysign() is required by C99 and
  already used without guards elsewhere in this file.
2022-01-13 09:37:17 +01:00
Daniel Llorens
6058d9e05d Simplify scm_abs for the real case
* libguile/numbers.c (scm_abs): As stated. When x is a nan with the sign bit
  set, this changes the behavior of (magnitude x) back to what it was in 3.0.7,
  to clear that bit.
2022-01-13 09:37:17 +01:00
Andy Wingo
9e5aa173c7 Optimize logand against a positive inum
* libguile/integers.c (scm_integer_logand_zi): Optimize.
2022-01-13 09:37:17 +01:00
Andy Wingo
6fe43301aa Optimize integer-expt for fixnums
* libguile/integers.c (scm_integer_expt_ii): Add some optimizations for
cases in which we can avoid allocating an mpz.
2022-01-13 09:37:17 +01:00
Andy Wingo
2cf80ca238 Optimize scm_integer_mul_ii
* libguile/integers.c (make_bignum_2): Always include.
(scm_integer_mul_ii): Avoid making a temporary allocation.
2022-01-13 09:37:17 +01:00
Andy Wingo
210ab8ff76 Optimize bignum subtraction
* libguile/integers.c (scm_integer_sub_iz):
(scm_integer_sub_zi):
(scm_integer_sub_zz): Optimize to avoid temporary allocations.
2022-01-13 09:37:17 +01:00
Andy Wingo
cc52f01aba Optimize bignum add to avoid temporary allocations
* libguile/integers.c (do_add_1, do_add, do_sub_1, do_sub, do_cmp): New
helpers.
(scm_integer_add_zi):
(scm_integer_add_zz): Use new helpers.
2022-01-13 09:37:17 +01:00
Andy Wingo
95350aae8c Avoid bignum clone in scm_integer_sub_zz
* libguile/integers.c (scm_integer_abs_z): Just call
scm_integer_negate_z if negation is needed.
(scm_integer_sub_zz): Use mpz_sub instead of cloning bignum.
2022-01-13 09:37:17 +01:00