* module/srfi/srfi-18.scm (<mutex>, with-thread-mutex-cleanup)
(make-mutex, mutex-state, abandon-mutex!, mutex-lock!): Manage
"abandoned" bit on Scheme side with no need for thread cleanup
handler.
* module/srfi/srfi-18.scm (<condition-variable>): New data type.
(make-thread): Use srfi-18 interfaces.
(mutex-unlock!): Adapt to optional cond argument being disjoint from
Guile condition variables.
(make-condition-variable, condition-variable-signal!)
(condition-variable-broadcast!): Adapt.
* module/srfi/srfi-18.scm (<mutex>): Define as a wrapper type around
Guile mutexes.
(thread-mutexes): New variable.
(with-thread-mutex-cleanup): New facility to abandon mutexes on
SRFI-18 thread exit. Not yet used.
(make-thread): Use SRFI-18 interfaces.
(make-mutex): Reimplement for our boxed mutexes.
(mutex-state): Adapt.
(mutex-lock!): Adapt.
(mutex-unlock!): Adapt.
* test-suite/tests/srfi-18.test: Don't assume that SRFI-18 mutexes are
the same as Guile mutexes.
* module/srfi/srfi-18.scm (%cancel-sentinel, thread-terminate!): Just
use cancel-thread to cause the thread to return a sentinel value.
(%timeout-sentinel): Rename from %sentinel.
(thread-join!): Adapt and transform %cancel-sentinel to a
&terminated-thread-exception.
* module/srfi/srfi-18.scm (make-thread): Inline some helpers, and use
just one catch block.
(thread->exception): Move up definition.
(exception-handler-for-foreign-threads): Use this as the default
handler, not the one that squirrels away exceptions in
thread->exception.
(thread-terminate!): Don't instate an exception handler for the thread
cleanup proc.
* module/srfi/srfi-18.scm (with-exception-handlers-here): New function.
(wrap): Remove.
(thread-join!, mutex-lock!): Use with-exception-handlers-here instead
of the call/cc+wrap mess.
* module/srfi/srfi-18.scm: Use srfi-35 conditions instead of our
home-grown equivalent system.
(thread-exception-handlers): Remove unused table.
(srfi-18-exception-handler): Always capture key consed to args; no
special case for bare key.
* test-suite/tests/srfi-18.test (provided?): Adapt to reason always
being key+args.
* module/srfi/srfi-18.scm: Use srfi-34 internally with srfi-34: prefix.
(current-exception-handler): Be a parameter.
(with-exception-handler): Adapt to current-exception-handler change.
(thread-join!, mutex-lock!): Adapt to use srfi-34: prefix.
* module/ice-9/boot-9.scm (map): Rewrite to be recursive and pure
instead of iterative and effectful. At best this is faster; at worst
it is slower. In any case it resolves continuation-related issues.
* module/srfi/srfi-1.scm (fold): Specialize the two-arg case.
(map): Rewrite to be recursive.
* test-suite/tests/r5rs_pitfall.test (8.3): Update for new expected map
behavior.
* module/ice-9/match.upstream.scm (match-next): Inline a call to
"error", so the new CSE pass will see this case as a bailout.
* module/srfi/srfi-9.scm (throw-bad-struct): Reimplement as a syntax
rule, so that the CSE pass sees the "throw" call.
* module/ice-9/boot-9.scm (map):
* module/srfi/srfi-1.scm (map): Simplify the implementations to check
for list? beforehand. It's faster, and it will be needed if we decide
to go recursive.
* module/ice-9/boot-9.scm (for-each):
* module/srfi/srfi-1.scm (for-each): Re-implement one-list case using an
explicit check for list? instead of the tortoise-hare thing. Seems to
be faster!
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
and length accessors, only accept bytevectors. Since arrays don't
work for u32vector-ref et al, they shouldn't pass u32vector?.
* module/ice-9/boot-9.scm:
* module/ice-9/i18n.scm:
* module/ice-9/poll.scm:
* module/ice-9/popen.scm:
* module/ice-9/r6rs-libraries.scm:
* module/oop/goops.scm:
* module/oop/goops/compile.scm:
* module/oop/goops/dispatch.scm:
* module/srfi/srfi-88.scm:
* module/system/foreign.scm:
* module/texinfo/serialize.scm: Change most uses of 'compile' to
'expand', except where we must avoid it during initial bootstrap
before the module system is loaded. Remove redundant uses of
'compile' where 'expand' is also given. Standardize on the
"(expand load eval)" order of conditions.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-16 and
srfi-30.
* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-16 and srfi-30 to the
list of core features.
* module/srfi/srfi-16.scm: Remove call to 'cond-expand-provide'.