* 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/threads.scm (cancel-tag): New variable.
(cancel-thread): New Scheme function.
(call-with-new-thread): Install a prompt around the thread.
* libguile/threads.h (scm_i_thread): Remove cancelled member.
* libguile/threads.c (scm_cancel_thread): Call out to Scheme. Always
available, and works on the current thread too.
(scm_set_thread_cleanup_x, scm_thread_cleanup): Adapt.
(scm_init_ice_9_threads): Capture cancel-thread var.
* doc/ref/api-scheduling.texi (Threads): Update.
* NEWS: Update.
The compiler was producing `((toplevel foo))' instead of `(toplevel foo)'.
Changed to use `call' form with target type and spliced constructor
arguments.
* module/language/ecmascript/compile-tree-il.scm (comp): Replace `@impl'
shorthand with `call' + `@implv' for better control over resulting
tree-il.
* test-suite/tests/ecmascript.test (compiler): Add test for "new Object();"
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/ice-9/boot-9.scm (module-defer-observers): Instead of being a
global flag, change to be a parameter.
(module-defer-observers-mutex, module-defer-observers-table): Remove.
(module-modified): Adapt.
(call-with-deferred-observers): Adapt. Allow nested called.
* libguile/async.c:
* libguile/async.h:
* libguile/deprecated.c:
* libguile/deprecated.h (scm_async, scm_async_mark, scm_run_asyncs):
Deprecate these functions, which comprise the "users asyncs" facility.
* module/oop/goops.scm: Adapt to <async> deprecation.
* doc/ref/api-scheduling.texi:
* doc/ref/libguile-concepts.texi:
* doc/ref/libguile-foreign-objects.texi:
* doc/ref/posix.texi: Remove documentation on user asyncs, and replace
references to "system asyncs" to be just "asyncs".
* module/language/cps/slot-allocation.scm
(add-prompt-control-flow-edges): Fix to add links from prompt bodies
to handlers, even in cases where the handler can reach the body but
the body can't reach the handler.
* test-suite/tests/compiler.test ("prompt body slot allocation"): Add
test case.
* module/texinfo/serialize.scm (include, empty-command, inline-text):
(inline-args, inline-text-args, eol-text-args, eol-text, eol-args)
(environ, table-environ, paragraph, item, entry, fragment, serialize)
(stexi->texi): Pass extra rest? parameter around to indicate arguments
that can take any number of subforms without being surrounded by
braces.
(embrace, serialize-text-args): Surround non-rest arguments with
braces.
* test-suite/tests/texinfo.serialize.test: Add tests.
* doc/ref/vm.texi (Inlined Atomic Instructions): New section.
* libguile/vm-engine.c (VM_VALIDATE_ATOMIC_BOX, make-atomic-box)
(atomic-box-ref, atomic-box-set!, atomic-box-swap!)
(atomic-box-compare-and-swap!): New instructions.
* libguile/vm.c: Include atomic and atomics-internal.h.
(vm_error_not_a_atomic_box): New function.
* module/ice-9/atomic.scm: Register primitives with the compiler.
* module/language/cps/compile-bytecode.scm (compile-function): Add
support for atomic ops.
* module/language/cps/effects-analysis.scm: Add comment about why no
effects analysis needed.
* module/language/cps/reify-primitives.scm (primitive-module): Add case
for (ice-9 atomic).
* module/language/tree-il/primitives.scm (*effect-free-primitives*):
(*effect+exception-free-primitives*): Add atomic-box?.
* module/system/vm/assembler.scm: Add new instructions.
* test-suite/tests/atomic.test: Test with compilation and
interpretation.
* libguile/tags.h (scm_tc7_smob):
* module/system/base/types.scm (%tc7-smob): Tweak this value, just to
prove that it can be done. Remove scary comment.
* module/language/tree-il/primitives.scm
(character-comparison-expander): Expand out char<? and friends to <,
unboxing the char arguments.
* module/language/cps/types.scm:
* module/language/cps/effects-analysis.scm: Remove mention of char<? and
friends as we won't see them any more. Also fixes#24318.
* module/language/cps/specialize-numbers.scm (truncate-u64): New helper,
truncates a SCM value.
(specialize-u64-binop): Add ulogxor case.
(sigbits-union, sigbits-intersect, sigbits-intersect3)
(next-power-of-two, range->sigbits, inferred-sigbits)
(significant-bits-handlers, define-significant-bits-handler):
(significant-bits-handler, compute-significant-bits): Add facility to
compute the bits in a value that are significant.
(specialize-operations): Unbox in more cases, when only u64 bits are
significant. Unbox logxor. Elide logand where it has no effect.
* module/web/http.scm (parse-entity-tag): Add #:sloppy-delimiters
keyword argument, and return a second value indicating the end
position.
(parse-entity-tag-list): Use parse-entity-tag, so that we also accept
sloppy etags that aren't qstrings.
* test-suite/tests/web-http.test ("request headers"): Add a test.
* module/language/cps/rotate-loops.scm (rotate-loops-in-function): Don't
attempt to rotate a loop whose header is a $prompt. Fixes use of
`continue' in `while'. Thanks to Nala Ginrut for the report :)
* m4/mkstemp.m4: Remove.
* lib/mkstemp.c: Remove.
* lib/mkostemp.c: New file.
* m4/mkostemp.m4: New file.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Remove mkstemp module, replace with mkostemp.
* libguile/fports.h:
* libguile/fports.c (scm_i_mode_to_open_flags): Factor out helper to
parse mode string to open flags.
(scm_open_file_with_encoding): Use the new helper.
* libguile/filesys.c:
(scm_i_mkstemp): Adapt to take optional second argument, being a mode
string. Use mkostemp.
(scm_mkstemp): Backwards compatible shim that calls scm_i_mkstemp.
* doc/ref/posix.texi:
* NEWS: Update.
* module/system/base/compile.scm (call-with-output-file/atomic): Pass
"wb" as mode, to cause O_BINARY to be added on MinGW.