config.rpath in the top-level was heavily outdated and unused. The
version of the script in build-aux/ was overwritten by autogen.sh;
commit 7f18b659b9 already tried to remove it two years ago, but did
not add it to .gitignore
* config.rpath, build-aux/config.rpath: Remove.
* .gitignore: Ignore build-aux/config.rpath.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Both macros were missing a quote for the procedure call, causing the
actual return value to be compiled into the ftw.go, instead of the
procedure call. Snippet from disassembly of ftw.go does confirm that:
55 (make-immediate 2 3990) ;; 997 at ice-9/ftw.scm:319:46
56 (make-long-immediate 1 120002) ;; 30000 at ice-9/ftw.scm:320:46
That effectively prevented ftw from entering directories without access
for others. Simple reproduction:
scheme@(guile-user)> ,use (ice-9 ftw)
scheme@(guile-user)> (mkdir "/tmp/xxxx")
scheme@(guile-user)> (chmod "/tmp/xxxx" #o0700)
scheme@(guile-user)> (ftw "/tmp/xxxx" (lambda (_ __ f) (pk f) #t))
;;; (directory-not-readable)
$1 = #t
scheme@(guile-user)> (system "ls -al /tmp/xxxx")
total 0
drwx------ 1 wolf wolf 0 Oct 11 22:54 .
drwxrwxrwt 1 root root 888 Oct 11 22:54 ..
$2 = 0
The fix is to quote the procedure call, leading to the intended
behavior.
Fixes <https://bugs.gnu.org/55344>.
* module/ice-9/ftw.scm (getuid-or-false): Quote the (getuid).
(getgid-or-false): Quote the (getgid).
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Until now, the ./meta/guile was not mentioned anywhere, and therefore it
was not obvious how to run the locally compiled Guile without installing
it.
While modifying the file, I took the liberty to also mention a bit about
compiling Guile using Guix.
Finally, the header lines where cleaned up, ensuring all of them end at
70 and have a leading space.
* HACKING (Hacking It Yourself): Add Guix instructions. Add a note
about meta/guile script.
(Sample GDB Initialization File),
(Naming conventions): Clean up the header line.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/ice-9/psyntax.scm (expand-top-sequence): When making a fresh
name for an introduced identifier, the hash isn't enough: it's quite
possible for normal programs to have colliding hash values, because
Guile's hash functions on pairs doesn't traverse the whole tree.
Therefore, append a uniquifying counter if the introduced name is
already defined in the current expansion unit.
* test-suite/tests/syntax.test ("duplicate top-level introduced
definitions"): Add test.
If `join-thread' timeout, the thread mutex is not unlocked, resulting in
deadlock to the next call to it or deadlock of the thread itself when it
terminates.
Thus, always unlock the mutex.
Fixes <https://bugs.gnu.org/55356>.
* module/ice-9/threads.scm (join-thread): Always unlock thread mutex.
* test-suite/tests/threads.test (join-thread): New test to ensure the
mutex is released.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes a regression introduced in
5a8502a494 and uncovered with
‘-DSCM_DEBUG_TYPING_STRICTNESS=2’ builds.
* libguile/scmsigs.c (scm_i_close_signal_pipe): Test
‘scm_i_signal_delivery_thread’ with ‘scm_is_true’ rather than pointer
equality.
While the `.' might be correct from a grammatical point of view (I do
not know), it turns the example into invalid scheme code, which is not
ideal. New users (like me) might try to copy the whole line and wonder
why it does not work (like I did). So delete it.
* doc/ref/srfi-modules.texi (SRFI-171 General Discussion): Delete the
trailing . from the example.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes <https://bugs.gnu.org/63366>.
Suggested by Sebastian Carlos <sebaaa1754@gmail.com>.
* doc/ref/intro.texi (Introduction): Remove reference to Python and
Perl, which no longer have “benevolent dictators”.
Fixes <https://bugs.gnu.org/68087>.
* libguile/scmsigs.h (scm_i_signals_pre_fork, scm_i_signals_post_fork):
New declarations.
(scm_i_signal_delivery_thread): Change type to SCM..
* libguile/threads.c (scm_all_threads): Adjust accordingly and exclude
threads that have ‘t->exited’. Access ‘thread_count’ after grabbing
‘thread_admin_mutex’.
* libguile/posix.c (scm_fork): Add calls to ‘scm_i_signals_pre_fork’ and
‘scm_i_signals_post_fork’.
* libguile/scmsigs.c (signal_delivery_thread): Close signal_pipe[0] upon
exit and set it to -1.
(once): New file-global variable, moved from…
(scm_i_ensure_signal_delivery_thread): … here.
(stop_signal_delivery_thread, scm_i_signals_pre_fork)
(scm_i_signals_post_fork): New functions.
* test-suite/standalone/test-sigaction-fork: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
This satisfies a longstanding complaint that Guile backtraces were being
truncated too much by default (72 columns), often hindering debugging.
* module/system/repl/debug.scm (default-frame-width): New variable.
(print-frames): Change default #:width value depending on whether PORT
is a tty.
* module/language/tree-il/primitives.scm (*primitive-constructors*):
(append): Recognize append and reduce it to only the two-operand form.
* module/language/tree-il/peval.scm (peval): Add optimizations to
append.
* module/language/tree-il/peval.scm (peval): When visiting (values) in
anything other than an effect or values context,
residualize (values (values)), which will cause a run-time error.
* test-suite/tests/peval.test ("values"): Add test.
Allowing variables to hold an unbound value and requiring a check on
each load is suboptimal; the fixing letrec boolean check is better. So
other runtimes (hoot) might preclude unbound variables by construction.
Allow them to do so.
* module/language/cps/guile-vm.scm (target-has-unbound-boxes?): New
definition.
* module/language/tree-il/compile-cps.scm (target-has-unbound-boxes?):
(%box-ref): Only residualize an unbound check if the target has unbound
boxes.
* module/language/tree-il/peval.scm (peval): Introduce raise-type-error
for dynwind unwinder thunk check.
* module/language/tree-il/compile-cps.scm (raise-type-error):
* module/language/tree-il/compile-bytecode.scm (canonicalize): Handle
raise-type-error, as it can be in Tree-IL now.
This keeps things higher level, and is a step towards structured
exceptions in guile.
* module/language/cps/guile-vm/reify-primitives.scm (reify-primitives):
Turn raise-type-error, raise-range-error, and raise-arity-error into
variants of "throw". Lower raise-exception to a non-tail primcall.
* module/language/tree-il/compile-cps.scm: Instead of residualizing
"throw/value+data" throws, exceptions introduced by CPS lowering are
more structured: raise-type-error, raise-range-error, and
raise-arity-error. Also, lower raise-exception to an ordinary `$throw`
instead of eagerly producing the non-tail call to a $prim.
* module/language/cps/specialize-numbers.scm (logand/immediate): Define
a sigbits handler.
(specialize-operations): Require logand/immediate operand to be u64 to
lower to ulogand/immediate. Shouldn't be necessary but even if only u64
bits are used, negative fixnums will have the sign bit set, which trips
up further unboxed uses which error if the operand to `scm->u64` is
negative.
* module/language/cps/type-fold.scm (rem): Emit logand/immediate.
Also rework so that the symbol hash uses the low bits instead of high
bits. We can do this because, for the guile-vm target, now we compute
the full target hash.
* module/language/cps/guile-vm.scm (jenkins-lookup3-hashword2):
(target-symbol-hash, target-symbol-hash-bits): New exported functions..
* module/language/cps/switch.scm (optimize-branch-chain): Change to use
target-symbol-hash and target-symbol-hash-bits from the current
target-runtime.
* libguile/jit.c (compile_ulogand_immediate, compile_ulogand_immediate_slow)
* libguile/vm-engine.c (ulogand_immediate): New JIT and interpreter
support for ulogand/immediate.
* module/language/cps/guile-vm/lower-primcalls.scm (string-ref):
(vtable-vtable?):
(vtable-field-boxed?): Emit ulogand/immediate.
* module/language/cps/guile-vm/reify-primitives.scm (reify-primitives):
Remove logand/immediate. Only emit ulogand/immediate if the immediate
is a u8. Refactor mul/immediate.
* module/language/cps/specialize-numbers.scm (specialize-operations):
Produce ulogand/immediate if the result is a u64.
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm (logand/immediate): Add effect and type
inference for logand/immediate, ulogand/immediate,
* module/language/cps/utils.scm (primcall-raw-representations):
ulogand/immediate makes a u64.
* module/language/tree-il/compile-cps.scm (convert): Generate
logand/immediate if possible.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/system/vm/assembler.scm (system): Add ulogand/immediate
emitter.
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* module/language/tree-il/peval.scm (peval): If a primcall is
effect-free, don't require that its args are too: just revisit args as a
sequence in effect context.
* module/language/tree-il/effects.scm (effect-free-primcall?): New
exported function.
* module/language/tree-il/peval.scm (peval): fix-letrec can residualize
useless primcalls, when a let or letrec-bound var is unused. Fix to
elide these.
* module/language/tree-il/effects.scm (add-primcall-effect-analyzer!):
New facility.
* module/language/tree-il/effects.scm (make-effects-analyzer): If a
primcall's args cause no effects, call out to a user-provided
effect-free? primitive for a primcall. If true, the primcall will be
marked as depending on all effects but causing none; this will allow it
to be elided by letrectify or peval.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
(*primitive-accessors*): Add string->utf8, utf8->string, and
string-utf8-length.
(primitive-module): New public function, moved here from (language
tree-il compile-bytecode).
* module/language/tree-il/compile-bytecode.scm: Use primitive-module
from (language tree-il primitives).
* module/language/tree-il/peval.scm (peval): A bugfix: load primitives
from their proper module. Allows bytevector primitives to fold.
* module/language/cps/guile-vm/reify-primitives.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm
* module/language/tree-il/primitives.scm:
* module/language/tree-il/cps-primitives.scm:
* module/language/tree-il/effects.scm (make-effects-analyzer):
Add string->utf8, utf8->string, and string-utf8-length.
* module/language/tree-il/compile-cps.scm (string->utf8)
(string-utf8-length, utf8->string): New custom lowerers, including type
checks and an unboxed result for string-utf8-length.
* module/system/vm/assembler.scm:
* libguile/intrinsics.h:
* libguile/intrinsics.c: Because string-utf8-length returns an unboxed
value, we need an intrinsic for it; go ahead and add an intrinsic for
string->utf8 and utf8->string too, as we will likely be able to use
these in the future.
Previously, these instructions were compiled directly. However, the JIT
also wants to fuse comparisons with branches, and an intervening "drop"
breaks that. Instead we take a different approach and rely on the
compiler only emitting push/pop/drop in a peephole sort of way, and we
can just simulate the temp stack space and dispatch directly.
* libguile/jit.c (compile_push, compile_push_slow, compile_pop):
(compile_pop_slow, compile_drop, compile_drop_slow): Crash if these are
called.
(COMPILE_WIDE_OP1, COMPILE_WIDE_OP2, COMPILE_WIDE_OP3, COMPILE_WIDE_OP4)
(COMPILE_WIDE_OP5):
(COMPILE_WIDE_DOP1, COMPILE_WIDE_DOP2, COMPILE_WIDE_DOP3)
(COMPILE_WIDE_DOP4, COMPILE_WIDE_DOP5): New helpers. I didn't manage to
share implementation with COMPILE_*.
(COMPILE_WIDE_*): New variants of compilers that take their operands
from an array instead of parsing the inline operands, relying on
convention for how the compiler emits these instructions.
(parse_wide_operands): New helper to parse out "wide" operands.
(compile1, compile_slow_path): If we see a "push", parse wide operands.
(compile): Move label capture for the slow path into compile_slow_path,
because wide operands may skip some instructions.
* libguile/jit.c (compile_*): Instead of using the minimum sized types
that can represent the instruction's operand, use uint32_t. This will
allow us to handle push/pop/drop without moving the SP.
* libguile/symbols.c (scm_symbol_to_string, scm_string_to_symbol):
Remove some confusing documentation that assumes that Guile is
case-insensitive, and which uses a word that may be perceived as a slur.
* module/ice-9/test.scm:
* test-suite/tests/r4rs.test: Rename a test to avoid using a slur.
* test-suite/tests/asyncs.test: Instead of wrapping abort-to-prompt with
false-if-exception, to handle edge cases, guard with
suspendable-continuation?: this also catches recursive invocations.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
(*effect-free-primitives*): Recognize keyword->symbol, symbol->keyword.
* module/language/tree-il/cps-primitives.scm: Plumb through to CPS.
(keyword->symbol):
* module/language/cps/effects-analysis.scm: New prims have no effect.
Fix effects for string->symbol.
(annotation->memory-kind): Add keywords.
* module/language/cps/guile-vm/lower-primcalls.scm (keyword->symbol):
Lower to scm-ref/immediate.
* module/language/cps/types.scm (annotation->type): Add case for
keywords.
* module/language/tree-il/compile-cps.scm: Add converters for new prims,
with type guards.
These numeric predicates now have CPS branching primcalls, which allows
type inference and folding to reduce them to less-strong instructions.
* module/language/cps/effects-analysis.scm (heap-numbers-equal?): Put
all the number predicates together. None have type checks.
* module/language/cps/guile-vm/lower-primcalls.scm
(define-branching-primcall-alias): New helper.
(complex?): Same as number?.
* module/language/cps/guile-vm/lower-primcalls.scm (real?)
(rational?, integer?, exact-integer?, exact?, inexact?): Define
lowerers.
* module/language/cps/type-fold.scm (number?, complex?, real?)
(rational?, integer?, exact-integer?, exact?, inexact?): Add folders and
reducers for all of these.
* module/language/cps/type.scm (number?, complex?, real?)
(rational?, integer?, exact-integer?, exact?, inexact?): Add type
inference for these.
* module/language/tree-il/compile-cps.scm (convert): Add number? checks
before exact? and inexact?. Remove the eager lowering of
exact-integer?; instead rely on folders.
* module/language/tree-il/cps-primitives.scm (number?, complex?)
(real?, rational?, integer?, exact-integer?, exact?, inexact?): Add
primitive decls. Define as "number-type-predicates?", meaning they need
a number? guard.
* module/language/cps/effects-analysis.scm: Mark more predicates as
effect-free. Sort the list.
* module/language/cps/guile-vm/lower-primcalls.scm (procedure?): Reify a
call to a primitive. Sadly we can't elide the $kreceive, as even though
we know that it's single-valued, $call can't continue to $kargs (has to
be $callk). Perhaps is worth relaxing in the future.
* module/language/cps/type-fold.scm: Define a number of additional
folders for disjoint types.
(procedure?): Define a folder for &procedure. Has to include structs,
though.
* module/language/cps/types.scm: Same as for type-fold.scm.
* module/language/tree-il/cps-primitives.scm: Lower procedure? primcalls
to CPS.