* doc/ref/api-data.texi (String Comparison): Remove documentation for
scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only
internal functions but static, and thus unusable by external code.
* module/ice-9/psyntax.scm (do, case): Comment out these definitions,
which are never used and immediately replaced by definitions in
boot-9.scm.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new,
rename-marks, make-rename): Remove these unused syntax rules.
Fix description of syntax wraps to match current reality.
* module/ice-9/compile-psyntax.scm: Minimize syntax object literals
embedded in psyntax-pp.scm.
* module/ice-9/psyntax.scm: Rename a few variables so that syntax
objects embedded in macros have no lexical bindings, so that their
minimized syntax objects will have no embedded labels. These labels
were the last remaining gensym counters in psyntax-pp.scm.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one
quarter of its previous size! More importantly, this file no longer
contains any gensym counters, which means that in the future, local
changes to psyntax.scm will usually result in only local changes to
psyntax-pp.scm.
* module/language/tree-il.scm (tree-il->scheme): New implementation that
simply calls 'decompile-tree-il'.
* module/language/scheme/decompile-tree-il.scm (choose-output-names,
do-decompile): New internal procedures.
(decompile-tree-il): New and improved implementation. Print source
identifiers where possible, otherwise add minimal numeric suffixes.
Previously we printed the gensyms. Avoid 'begin' in contexts that
provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or',
'let*', named let, and internal defines where appropriate. Recognize
keyword arguments in 'opts' to disable the production of these derived
syntactic forms, and to optionally strip numeric suffixes from
variable names.
* module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec
fixing, and primitive expansion when producing psyntax-pp.scm, in
order to produce output as close to the original source as practical.
Disable production of derived syntactic forms as needed during
bootstrap. Strip numeric suffixes from variable names. Adjust
pretty-printing parameters.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half
of the original size.
* libguile/vm-i-system.c (wind):
* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
Instead of making `wind' call `scm_thunk_p' on the winder and unwinder
at runtime, make it the responsibility of the compiler to emit code to
call thunk? and error, but only if the compiler cannot prove them to
be thunks.
* libguile/vm-engine.c (vm_engine): Remove a now-unused error block.
* libguile/dynstack.h:
* libguile/dynstack.c: New files, implementing the dynamic stack as a
true stack instead of a linked list. This lowers the cost of
dynwinds: frames, winders, prompts, with-fluids, and dynamic-wind.
For the most part, we allocate these items directly on the stack.
* libguile/dynwinds.h:
* libguile/dynwinds.c: Adapt all manipulators of the wind stack to use
interfaces from dynstack.c. Remove heap-allocated winder and frame
object types.
(scm_dowinds, scm_i_dowinds): Remove these. The first was exported,
but it was not a public interface.
* libguile/continuations.c:
* libguile/continuations.h (scm_t_contregs): Continuation objects
reference scm_t_dynstack* values now. Adapt to the new interfaces.
* libguile/control.c:
* libguile/control.h: There is no longer a scm_tc7_prompt kind of object
that can be allocated on the heap. Instead, the prompt flags, key,
and registers are pushed on the dynwind stack. (The registers are
still on the heap.) Also, since the vm_cont will reference the
dynwinds, make the partial continuation stub take just one extra arg,
instead of storing the intwinds separately in the object table.
* libguile/fluids.c:
* libguile/fluids.h: No more with-fluids objects; instead, the fluids go
on the dynstack. The values still have to be on the heap, though.
(scm_prepare_fluids, scm_swap_fluids): New internal functions,
replacing scm_i_make_with_fluids and scm_i_swap_with_fluids.
* libguile/print.c: Remove prompt and with-fluids printers.
* libguile/tags.h: Revert prompt and with-fluids tc7 values to what they
were before they were allocated.
* libguile/vm-i-system.c (partial_cont_call): Just pop the vmcont, the
intwinds will not be passed as a second arg. Rewind the dynamic stack
from within the VM, so that any rewinder sees valid prompt entries.
(call_cc, tail_call_cc): Adapt to pass the dynstack to
scm_i_vm_capture_stack.
(prompt, wind, unwind, wind_fluids, unwind_fluids): Adapt to the new
interfaces.
* libguile/vm.h (scm_i_capture_current_stack): Rename from
scm_i_vm_capture_continuation.
(scm_i_vm_capture_stack): Take a dynstack as an argument.
* libguile/vm.c (vm_reinstate_partial_continuation): Don't wind here, as
that could result in winders seeing invalid prompts.
* libguile/eval.c:
* libguile/root.c:
* libguile/stacks.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c: Adapt other users of dynwinds to use the dynstack.
* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument
'#:max-expr-width'.
(generic-write): Add new argument 'max-expr-width'. Previously this
was internally defined to the constant value 50.
* libguile/weak-table.h:
* libguile/weak-table.c (scm_weak_table_putq_x)
(scm_weak_table_remq_x, scm_weak_table_clear_x)
(scm_weak_table_for_each): Declare these as returning void instead of
SCM.
* libguile/hashtab.c (scm_hashq_set_x, scm_hashq_remove_x)
(scm_hashv_set_x, scm_hashv_remove_x)
(scm_hash_set_x, scm_hash_remove_x)
(scm_hashx_set_x, scm_hashx_remove_x):
(scm_hash_for_each): For weak tables, have the set! functions return
the values, as they used to do. Have remove! functions return #f,
indicating the lack of a handle. Shim around for-each to return
unspecified, even though that wasn't yet a problem.
* test-suite/tests/weaks.test: Add a test.
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less
false-if-exception and more variable-bound?. If a variable is present
in the local module but not bound, assume that it is gettext if it has
the right name. This is to allow for (define _ gettext).
* test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
There are a some failures currently:
FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration
ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
Conflicts:
module/language/tree-il/peval.scm
module/language/tree-il/primitives.scm
test-suite/tests/tree-il.test
* module/language/tree-il/peval.scm (peval): Add optimization to
hoist the inner procedure out of e.g.
(lambda args (apply (lambda ...) args))
This commit restores the ability to detect escape-only prompts at
compile-time.
* test-suite/tests/tree-il.test: Update test for prompt with a lambda,
and add a specific test for lambda application.
* module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in
which the sense of `escape-only?' was reversed. We never saw this
though, because for other reasons, no prompts were being identified as
escape-only.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
Don't limit the call-with-prompt to <prompt> transition to lambda
expressions. Instead we can lexically bind the handler, and rely on
peval to propagate a lambda expression.
* module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even
if the expression appears atomic, because in the presence of
'identifier-syntax', we cannot know what an atomic expression will
later expand to. Also use '#:export-syntax' instead of '#:export'
to export 'pmatch'.
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm
(define-bytevector-type): Fix definition of <TAG>vector-length when
applied to uniform vectors of different element sizes. Thanks to
Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug.
* test-suite/tests/srfi-4.test: Add tests.
* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref'
in `false-if-exception'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string with forward declaration"): New test.
* test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of
an and. Before, they were not being run, for some reason I don't
fully understand.
* libguile/finalizers.c: New excitement! We'll be running finalizers in
threads, if that's available. If it's not available, during early
boot, we can run finalizers in asyncs. This will make it safer to
allocate while holding a mutex.
* libguile/posix.c (scm_fork): Shut down the finalizer thread before
forking.
* libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism
during boot and, if available, initialialize the finalizer thread at
the very end.
* libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing
on demand.
(scm_gc): Explicitly run finalizers here. If you're calling this
function, you probably want synchronous GC.
* libguile/posix.c (scm_fork): Signal an error if a `fork' is attempted
after threads have been spawned.
* test-suite/tests/00-socket.test: Moved here, from socket.test, so as
to run before any threads are created.
* test-suite/Makefile.am: Adapt.
* libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid
allocations and other calls that are not async-signal-safe.
(scm_init_popen, scm_init_posix): Register popen extension.
* module/ice-9/popen.scm: Load the popen extension, to get open-process.
* module/language/tree-il/primitives.scm: add equality-primitive?,
which is true for eq?, eqv?, and equal?
* module/language/tree-il/peval.scm: if an equality primitive is
applied to the same variable twice, fold it to #t
* test-suite/tests/tree-il.test: add tests for pevaling equality
primitives
* module/language/tree-il/analyze.scm (gettext?): Rename to...
(proc-ref?): ... this. Add `proc' and `special-name' parameters.
(gettext?): Define in terms of `proc-ref?'.
(ngettext?): New procedure.
(const-fmt): Recognize `ngettext' calls.
(format-analysis)[<down>](check-format-args]: Check
constant-but-non-string 2nd argument in the (not (const-fmt ...))
case.
[check-simple-format-args]: Use `const-fmt'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using ngettext", "non-literal format string using
ngettext as N_"): New tests.
("simple-format")["unsupported, ngettext"]: New test.
Fixes <http://bugs.gnu.org/10846>.
Reported by Bruno Haible <bruno@clisp.org>.
* module/language/tree-il/analyze.scm (gettext?): New procedure.
(const-fmt): Add `env' parameter; update callers. Use `gettext?'.
(format-analysis)[check-simple-format-args]: Actually support
gettextized format strings.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using gettext"): Use `gettext' as the procedure name.
("non-literal format string using gettext as _"): New test.
["simple-format"]("unsupported, gettext"): New test.
* libguile/weak-set.c:
* libguile/weak-table.c: Attempt to avoid bouncing between sizes when
growing the vector causes elements to be removed from the set/table.
* libguile/modules.c: In my current image, there are 1790 bindings in
the root module, which tips over to the next hash vector size, so
declare that to prevent rehashing.
* libguile/srcprop.c (scm_init_srcprop): Don't preallocate a big
source_whash table, as we might not need it (if everything is
compiled, for example).
* module/ice-9/boot-9.scm (make-module): Don't preall-cate big hash
tables for imported bindings. Instead trust that resizing works
correctly.
* libguile/fports.c (scm_revealed_count, scm_port_revealed)
(scm_set_port_revealed_x, scm_adjust_port_revealed_x): Move these APIs
here, and only operate on fports. To keep revealed ports alive, now
we will just keep them in a data structure that the GC knows about --
a static list.
* libguile/fports.h: Add revealed count to scm_t_fport, and move decls
of revealed-count functions here.
* libguile/ports.h:
* libguile/ports.c: Adapt to change. Remove SCM_REVEALED and
SCM_SETREVEALED; since they only apply to fports now, keeping them
around would be inviting type errors.
(finalize_port): We don't need to worry about resuscitating ports
here.
* libguile/init.c: Use the scm_set_port_revealed_x function to set the
revealed counts on stream ports.