* module/scheme/base.scm (member): Match the r7rs requirement, as assoc
already does.
Thanks to Erik Dominikus for reporting the problem.
Closes: 43304
The line, part of the sentence above it in a comment, was accidentally
removed in commit b8d757732f "Rationalize
include order in C files".
* libguile/guile.c: restore missing line.
[rlb@defaultvalue.org: augment commit message; add THANKS]
Closes: 42331
* libguile/srfi-13.c (scm_reverse_list_to_string): Replace string->list
with list->string in the composition explaning how it works. Thanks
to Andrey Ivanov for reporting the problem.
Closes: 34457
* module/rnrs/io/ports.scm (call-with-port): Remove local definition.
* module/system/repl/server.scm (system): Call-with-port is imported
via (ice-9 ports).
* module/ice-9/binary-ports.scm (call-with-input-bytevector):
(call-with-output-bytevector): New functions.
* module/ice-9/iconv.scm: Remove superfluous copies of
call-with-output-string* and call-with-output-bytevector*, now that
the former closes the port and the latter exists.
(call-with-encoded-output-string): Adapt.
* module/web/uri.scm: Use (ice-9 iconv) instead of local
bytevector/string conversion procedures.
* module/ice-9/ports.scm (call-with-port): New procedure, from r7rs.
(call-with-input-file, call-with-output-file): Refactor to use
call-with-port.
(call-with-output-string): Close the string after normal exit.
* module/scheme/base.scm (scheme): Re-export call-with-port from base.
* lightening/x86.c (jit_try_shorten): If the address is within the
last instruction, don't shorten. If the intstruction is a jump, we
could elide it entirely in some cases, but we don't know if the user
captured the PC before calling jit_patch_here. Better to leave this
to the user.
Thanks to Helmut Eller for the bug report and test case in
https://gitlab.com/wingo/lightening/-/issues/17.
* module/ice-9/boot-9.scm (%auto-compilation-options): Add
use-before-definition and non-idempotent-definition.
* module/language/tree-il/analyze.scm (<use-before-def-info>): New
analysis info.
(make-use-before-definition-analysis): New function.
(goops-toplevel-definition): Move down.
(unbound-variable-analysis, macro-use-before-definition): Remove, as
they are subsumed by use-before-def. There are some deprecated
bindings though.
(make-analyzer): Rework to allow for use-before-def analysis to handle
multiple
* module/system/base/message.scm (%warning-types): Add handlers for the
new warning types.
* test-suite/tests/tree-il.test: Add tests.
* doc/ref/api-evaluation.texi (Compilation): Update.
* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE): Bump a bit farther (2 MB on
64-bit, 1 MB on 32-bit) as we now expand to this size instead of
expanding by this amount.
(scm_storage_prehistory): Expand to the initial heap size instead of
expanding by the size.
* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE): Bump to 1.6 MB on 64-bit
targets, or 800 kB on 32-bit targets, to account for increased
footprint. Prevents useless early GC.
(scm_storage_prehistory): Remove unused code to dynamically change the
free space divisor.
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION): Accept up to version 4.
* module/system/vm/assembler.scm (*bytecode-minor-version*): Produce
version 4.
* module/language/cps/cse.scm (intset-intersect*): New helper. Use it
to replace manual uses.
(lset-unionq, meet-constants, adjoin-constant, set-constants): New
helpers.
(compute-consts): New function, to compute constants at each label,
using not only definitions but flow.
(<analysis>): Add consts to analysis.
(elide-predecessor, prune-branch, forward-branch, compute-out-edges)
(propagate-analysis, eliminate-common-subexpressions-in-fun): Plumb
consts through the algorithm.
(fold-branch): Fold an eq-constant? using the flow-determined constant
info. Finally allows compile-bytecode to fold to switch statements!
* module/language/cps/optimize.scm (optimize-first-order-cps): Move
branch chain optimization before the final CSE/DCE pass.
Reported by Jérémy Korwin-Zmijowski
(https://lists.gnu.org/archive/html/bug-guile/2020-08/msg00010.html).
Fix from
7cf4c01039:
Apply fix from Per Bothner.
In Per's words:
* testing.scm (%test-end): Reset test-runner-current if done.
This fixes bug "Loading test source file multiple time without having
report incrementing" reported to srfi-64 mailing list.
* srfi-64-test.scm: Update due to recent srfi-64 implementation change.
* module/language/cps/compile-bytecode.scm (compile-function): Expect
eq-constant? instead of eq-null?, etc.
* module/language/cps/effects-analysis.scm: Likewise.
* module/language/cps/reify-primitives.scm (reify-primitives): For
eq-constant?, reify a $const unless the constant is an immediate whose
encoding fits in 16 bits.
* module/language/cps/type-fold.scm (materialize-constant): Helper to
make a constant from a type, min, and max.
(fold-eq-constant?): New helper.
(eq-constant?): New folder.
(undefined?): Define specifically.
(define-nullish-predicate-folder): Renamd from
define-special-immediate-predicate-folder. Use only for null?, false,
and nil?.
(*branch-reducers*): New mechanism. Reduce eq? to eq-constant? if
possible.
(local-type-fold): Refactor to use materialize-constant, and to allow
reducing branches.
* module/language/cps/types.scm (constant-type): Return three values
instead of a type entry.
(constant-type-entry): New function that returns a type entry. Adapt
callers.
(infer-constant-comparison): New helper.
(eq-constant?): New inferrer.
(undefined?): New inferrer.
* module/language/tree-il/compile-bytecode.scm (eq-constant?): Fix
truncate-bits signed arg.
(define-immediate-type-predicate): Adapt to visit-immediate-tags
change.
* module/language/tree-il/compile-cps.scm (convert): Convert eq? to
constant to eq-constant?. Advantaged is that it gets fixnums and
chars in addition to special immediates.
* module/language/tree-il/cps-primitives.scm (define-immediate-type-predicate):
Adapt to allow #f as pred.
* module/system/base/types/internal.scm (immediate-tags): Use #f as pred
for false, nil, etc.
(immediate-bits->scm): Adapt.
* module/system/vm/assembler.scm (emit-eq-null?, emit-eq-nil?)
(emit-eq-false?, emit-eq-true?, emit-unspecified?, emit-eof-object?):
Remove specialized emitters.
* module/system/vm/assembler.scm (define-immediate-tag=?-macro-assembler):
Allow for pred to be #f.
* module/system/vm/disassembler.scm (define-immediate-tag-annotation):
Adapt to pred being #f.
* module/language/tree-il/compile-bytecode.scm (eq?): Define
eq-immediate? as immediate emitter.
(canonicalize): Don't fuss so much about eq?; only if commutation is
needed. (Perhaps a more generic commutation pass is needed.)
(compile-closure): Add support for emit/immediate for branches.
* module/system/base/types/internal.scm (scm->immediate-bits):
(immediate-bits->scm, sign-extend, truncate-bits): New public
routines.
* module/system/vm/assembler.scm (immediate-bits): Reimplement in terms
of scm->immediate-bits and similar.
(X8_S8_I16, X8_S8_ZI16): Rework operand encodings.
(load-constant): Use truncate-bits to determine which cases apply.
* doc/ref/vm.texi (Instruction Set, Constant Instructions): Document new
instruction.
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): New first
word kind with zi16 operand.
* libguile/jit.c (compile_make_immediate, compile_make_immediate_slow):
New compilers.
(COMPILE_X8_S8_ZI16): New operand kind.
* libguile/vm-engine.c (make-immediate): New instruction.
* module/language/bytecode.scm:
* module/system/vm/assembler.scm (encode-X8_S8_ZI16<-/shuffle):
(signed-bits, load-constant): Support the new instruction kind.
* module/system/vm/disassembler.scm (disassemblers)
(sign-extended-immediate, code-annotation): Support for zi16
operands.
* lightening/lightening.c (abi_gpr_to_mem): Write whole words when
spilling GPRs to the stack. Always correct given that all Lightening
operations that write GPRs write the whole register, and the current
ABI targets allow writing the extra words. Closes#15.
Prevents useless over-alignment for ARM.
* lightening/lightening.c (struct jit_literal_pool_entry): Value is a
uintptr_t.
(emit_uintptr): New helper.
(emit_abs_reloc): Use new helper.
(patch_pending_literal): Value is a uintptr_t.
(emit_literal_pool): Adapt to literal entry being uintptr_t.
* lightening.h:
* lightening/lightening.c (jit_begin_data): Add max data size
parameter. If nonzero, can allow the JIT to avoid prematurely
emitting a constant pool.
(jit_end_data): Allow pending literals.
* tests/jmp_table.c (run_test): Use new API.
* lightening.h:
* lightening/lightening.c (jit_begin_data, jit_end_data)
(jit_emit_u8, jit_emit_u16, jit_emit_u32, jit_emit_u64): Add new raw
data-emitting primitives, bracketed by begin/end so that we can flush
constant pools first, if needed.
* lightening/lightening.c (struct jit_state): Add new emitting_data
flag.
(jit_begin, jit_reset, jit_end): Handle the new flag.
(emit_abs_reloc): Move here, from x86.c.
* lightening/x86.c (emit_abs_reloc): Remove.
(jit_try_shorten): Don't shorten if loc == start; could be raw data.
* tests/jmp_table.c: New test.