* doc/ref/compiler.texi (Bytecode): Update macro-assembler instructions,
and move most of them to the instruction set reference.
* doc/ref/vm.texi (A Virtual Machine for Guile, VM Programs): Minor
fixes.
(Instruction Set): Update for Guile 3 instruction set.
* libguile/vm-engine.c (vm_engine): Update a few instruction
docstrings.
* module/language/cps.scm ($rec): Replace $letrec with $rec, which is an
expression, not a term. This means that the names bound by the letrec
appear twice: once in the $rec term, and once in the continuation.
This is not very elegant, but the situation is better than it was
before. Adapt all callers.
* doc/ref/compiler.texi (CPS in Guile): Incomplete documentation
updates. I'll update these later when the IL settles down.
* module/language/cps.scm ($callk): New expression type, for calls to
known labels. Part of "low CPS".
* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/verify.scm: Adapt call sites.
* libguile/vm-engine.c (call-label, tail-call-label): New instructions.
Renumber the rest; this is an ABI change.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
* doc/ref/compiler.texi (CPS in Guile): Document $callk.
* doc/ref/api-macros.texi (Macro Expansion): New section.
* doc/ref/api-procedures.texi (Compiled Procedures): Beginnings of a
revision. Not finished.
* doc/ref/compiler.texi (Compiling to the Virtual Machine): Beginnings
of a revision. CPS and bytecode are not done yet.
* libguile/vm-i-system.c (push-fluid, pop-fluid):
* doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids
to push-fluid, and unwind-fluids to pop-fluid. They now only work on
one fluid binding at a time.
* module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of
primcalls to push-fluid and pop-fluid.
(custom-throw-handler, catch, with-throw-handler): Use with-fluid*
instead of with-fluids, as with-fluids is no longer available before
psyntax is loaded.
(with-fluids): Define in Scheme in terms of with-fluid*.
* libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and
don't expose to Scheme.
* libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case.
* libguile/expand.c (expand_with_fluids): Remove with-fluids syntax.
(DYNLET): Remove, no longer defining dynlet in the %expanded-vtables.
* libguile/expand.h: Remove dynlet definitions.
* module/ice-9/eval.scm (primitive-eval): Remove with-fluids case.
* libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive
helpers, like wind and unwind.
(memoize): Memoize wind and unwind primcalls. Don't memoize dynlet to
with-fluids.
(scm_init_memoize): Initialize push_fluid and pop_fluid here.
* libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition.
* module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported
with-fluids, which is now defined in boot-9.
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/compiler.texi (Tree-IL):
* module/language/tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/canonicalize.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/cse.scm:
* module/language/tree-il/debug.scm:
* module/language/tree-il/effects.scm: Remove <dynlet>. Add cases for
primcalls to push-fluid and pop-fluid in compile-glil.scm and
effects.scm.
* module/language/tree-il/peval.scm (peval): Factor out
with-temporaries; probably a bad idea, but works for now. Factor out
make-begin0 (a better idea). Inline primcalls to with-fluid*, and
remove dynlet cases.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
Add with-fluid*.
* doc/ref/compiler.texi: Remove mention of <dynwind>.
* libguile/eval.c (eval): Remove SCM_M_DYNWIND case.
* libguile/expand.c: Remove scm_sym_at_dynamic_wind.
* libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If
we see a wind or unwind primcall, we expand to a call of a quoted subr
value. It works and removes a kind of memoized value from the
interpreter. For the compiler,primcalls to wind and unwind are
handled specially.
(MAKMEMO_DYNWIND): Remove.
(scm_tc16_memoizer): Remove. Yay!
(memoize): Remove speculative lookup for toplevels to see if they are
memoizers: there are no more memoizers. Memoize calls to the wind and
unwind primitives.
(m_dynamic_wind): Remove.
(unmemoize): Remove dynwind case.
(scm_init_memoize): Add wind and unwind local definitions.
* module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind"
and "unwind" primitives. These primitives are not exposed to other
modules.
* module/ice-9/eval.scm (primitive-eval): Remove dynwind case.
* module/language/scheme/decompile-tree-il.scm (do-decompile):
(choose-output-names): Remove dynwind cases.
* module/language/tree-il.scm: Remove <dynwind>. Yaaay!
* module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind
cases.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind
and unwind.
(flatten-lambda-case): Remove dynwind case. Yay!
* module/language/tree-il/cse.scm (cse):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/peval.scm (singly-valued-expression?, peval):
Remove <dywind> cases. Inline primcalls to dynamic-wind. Add
constant folding for thunk?.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
Remove @dynamic-wind, and add procedure? and thunk?.
(*effect+exception-free-primitives*): Add procedure? and thunk?.
(*multiply-valued-primitives*): Remove @dynamic-wind.
Remove @dynamic-wind expander.
* test-suite/tests/peval.test ("partial evaluation"): Update tests for
dynwind desugaring.
* doc/ref/api-debug.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-modules.texi:
* doc/ref/compiler.texi:
* doc/ref/web.texi: Make Texinfo function headers more consistent.
Change lesser used keyword notation to the predominant form.
* doc/ref/api-procedures.texi: Fix an argument name in a header that should
use repeated argument notation.
* doc/ref/srfi-modules.texi: Update references in Texinfo function
definition body to match previously updated variable notation in
definition header.
* module/system/base/language.scm (<language>): Add 'for-humans?'
field, and export new 'language-for-humans?' predicate.
* doc/ref/compiler.texi (Compiler Tower): Document.
* module/language/assembly/spec.scm, module/language/bytecode/spec.scm,
module/language/glil/spec.scm, module/language/objcode/spec.scm,
module/language/tree-il/spec.scm, module/language/value/spec.scm:
Mark these languages as 'for-humans?'.
* module/ice-9/boot-9.scm (current-language): New parameter.
* module/system/base/language.scm (*current-language*): Pull fluid from
parameter.
(current-language): Now a re-exported parameter.
* doc/ref/compiler.texi: Update reference from *current-language* fluid
to current-language parameter.
* module/system/base/compile.scm (compile-and-load):
* module/ice-9/top-repl.scm (top-repl): Default to the current language,
not to Scheme.
* module/ice-9/eval-string.scm:
* module/system/base/language.scm:
* module/system/repl/command.scm:
* module/system/repl/repl.scm: Update to use current-language parameter
and parameterize.
* libguile/objcodes.c: Change to expect objcode on disk to be embedded
in ELF instead of having the funky cookie.
(to_native_order): Use already existing SCM_BYTE_ORDER style byte
order instead of chars.
(bytecode_to_objcode): No need for word_size arg.
(scm_bytecode_to_objcode, scm_objcode_to_bytecode): Take optional
endianness arg instead of sometimes using target-endianness.
(scm_load_objcode, scm_write_objcode, scm_bytecode_to_native_objcode):
Remove.
* libguile/objcodes.h: Adapt.
* libguile/vm.c (scm_load_compiled_with_vm): Use
scm_load_thunk_from_file.
(make_boot_program): Adapt to use scm_bytecode_to_objcode with
endianness arg.
* module/Makefile.am (OBJCODE_LANG_SOURCES): Add (language objcode
elf).
* module/language/objcode/elf.scm: New module, embeds objcode in ELF.
* module/language/bytecode/spec.scm (compile-objcode):
(decompile-objcode): Use (target-endianness).
* module/language/objcode/spec.scm: use (language objcode elf) for
write-objcode.
* module/scripts/disassemble.scm (disassemble):
* module/system/repl/command.scm (disassemble-file): Use
load-thunk-from-file.
* module/system/vm/objcode.scm: Remove load-objcode and write-objcode.
* test-suite/tests/asm-to-bytecode.test (test-target): Adapt to the new
ELF world.
* module/language/tree-il.scm (<tree-il>): Add `pre' and `post' fields
to <dynwind>, so that we can inline the guard bodies in the normal
control-flow case. It also avoids duplicating code in compile-glil,
which probably hides more bugs in 2.0.
(parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold)
(make-tree-il-folder, post-order!, pre-order!): Update.
* module/language/tree-il/analyze.scm (analyze-lexicals): Update.
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update
to use `pre' and `post' instead of compiling code twice.
* module/language/tree-il/debug.scm (verify-tree-il): Update.
* module/language/tree-il/peval.scm (peval): Update. Instead of doing
complicated things in <dynwind>, handle 'dynamic-wind primcalls.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
Remove 'dynamic-wind mess. Adapt '@dynamic-wind.
* test-suite/tests/tree-il.test ("partial evaluation"): Update tests.
* doc/ref/compiler.texi: Update for new ,pp meta-command.
* doc/ref/scheme-using.texi (Using Guile Interactively): Show value
history in examples.
(Value Historyx): Update docs to mention the repl option and the
programmatic interface.
* doc/ref/compiler.texi (Compiler Tower): Update for removal of version
from <language>, and add joiner and make-default-environment fields.
Update examples.
(The Scheme Compiler): Update for `macroexpand' instead of
`sc-expand', and that the environment must be a module.
(Tree-IL): Update for new Tree-IL, and change from "vars" to
"gensyms".
(GLIL): Update for new GLIL, including preludes and prompts.
(Assembly): Update for current output (which seems quite verbose).
(Bytecode and Objcode): Update for current output, and some procedure
name changes.
* doc/ref/vm.texi: Update with documentation for new-ish instructions,
and reorganize the sections a bit.
* doc/ref/compiler.texi (GLIL): Fix up a couple xrefs.
This is a followup to 87c595c757 ("Compile
in a fresh module by default.") and
f65e2b1ec5 ("Honor and confine
expansion-time side-effects to `current-reader'.").
* doc/ref/api-evaluation.texi (Loading): Explain how to change
`current-reader' in a compiler-friendly way.
* doc/ref/compiler.texi (The Scheme Compiler): Explain use of a fresh
compilation module and separate `current-reader' fluid.
* test-suite/tests/compiler.test ("current-reader")["with eval-when"]:
New test.