* module/language/cps/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-cps.scm (compile-cps): Rely on
compiler to lower incoming term already.
* module/language/tree-il/optimize.scm (make-lowerer): New procedure.
* module/system/base/compile.scm (compute-lowerer): New procedure,
replaceing add-default-optimizations.
(compute-compiler): Lower before running compiler.
* module/system/base/language.scm (<language>): Change
optimizations-for-level field to "lowerer".
* module/scripts/compile.scm (%options, compile): Parse -O0, -O1 and so
on to #:optimization-level instead of expanding to all the
optimization flags.
* module/language/cps/optimize.scm (lower-cps): Move here from
compile-bytecode.scm.
(make-cps-lowerer): New function.
* module/language/cps/spec.scm (cps): Declare lowerer.
* module/language/tree-il/analyze.scm (make-analyzer): Expect an int for
optimization level.
* module/scripts/compile.scm (%options, show-warning-help): No more
-Wnone / Wall; use -W0 or -W9 instead.
* module/system/base/compile.scm (level-validator): Validate small int.
(compute-analyzer, add-default-optimizations): Likewise.
* test-suite/tests/optargs.test (without-compiler-warnings):
* test-suite/tests/tree-il.test (call-with-warnings): Parameterize level
to 0, not #f.
* bootstrap/Makefile.am (GUILE_WARNINGS): Use -W0, not -Wnone.
* am/guilec (GUILE_WARNINGS):
* am/bootstrap.am (GUILE_WARNINGS): Explictly default to -W1.
* bootstrap/Makefile.am (GUILE_WARNINGS): Set to -Wnone, as the meaning
of "no -W flags" has changed to be effectively -W1.
* module/scripts/compile.scm (%options): Adapt to parse -Wnone, -W2, and
so on.
(parse-args): Default to (default-warning-level).
(show-warning-help): Add more warning help.
(compile): Pass #:warning-level.
* module/scripts/use2dot.scm: Load (ice-9 getopt-long) with #:use-module
rather than #:autoload. With the previous #:autoload spec, 'option-ref'
would be unbound due to the new autoload semantics.
* module/scripts/frisk.scm: Load (ice-9 getopt-long) with #:use-module
rather than #:autoload. With the previous #:autoload spec, 'option-ref'
would be unbound due to the new autoload semantics.
Fixes a bug whereby "guild compile --target=arm-linux-gnueabihf
--from=elisp ... language/elisp/boot.el" would fail with an exception
from 'load-thunk-from-memory' while trying to load (language elisp spec)
from the guile-being-compiled instead of using that of the
guile-for-build.
The problem did not manifest with --from=scheme because (language scheme
spec) happened to be already loaded before we had changed %load-path.
* module/scripts/compile.scm (compile): Add calls to 'lookup-language'.
* module/system/base/optimize.scm: New module.
* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add new module.
* module/language/tree-il/optimize.scm (tree-il-optimizations): Rename
from tree-il-default-optimization-options. Directly specify the
optimization level at which a pass should be enabled.
* module/language/cps/optimize.scm (cps-optimizations): Likewise, rename
from cps-default-optimization-options.
* module/scripts/compile.scm (%options, show-optimization-help): Adapt
to use new module.
* module/scripts/compile.scm (%options): Resurrect -O option and make it
follow GCC, more or less. The default is equivalent to -O2.
* module/language/cps/compile-bytecode.scm (lower-cps):
* module/language/cps/optimize.scm (optimize-higher-order-cps): Move
split-rec to run unconditionally for now, as closure conversion fails
without it.
(define-optimizer): Only verify the result if we are debugging, to
save time.
(cps-default-optimization-options): New exported procedure.
* module/language/tree-il/optimize.scm
(tree-il-default-optimization-options): New exported procedure.
* libguile/guile-snarf.in (modern_snarf): Rewrite sed script to cope
with newlines in the snarfed code segments, or multiple code segments
on the same line.
* module/scripts/snarf-check-and-output-texi.scm (process-stream):
Strip all 'hash' tokens from the stream.
(do-command): Remove special cases that handled 'hash' tokens
in a few places.
* module/scripts/disassemble.scm (disassemble): Update to work with
RTl (and only RTL, as that's the future).
* module/system/vm/debug.scm (for-each-elf-symbol): New public
interface.
(debug-context-from-image): New helper.
(find-debug-context): Use the helper.
* module/system/vm/disassembler.scm (disassemble-image): New public
interface.
* 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/scripts/help.scm (show-help, show-summary, show-usage): Grovel
for %synopsis and %help variables as well, and show them
appropriately. Export these routines for other script modules to
use. Needs documentation.
* meta/guild.in (display-version): Display the version, not the
effective version.
* module/scripts/help.scm (list-commands)[help]: Add proper footer, as
per the GCS.
* meta/guild.in (display-version): Use (ice-9 command-line)'s
version-etc.
(main): Dispatch --help to guild help.
* module/scripts/help.scm: New file, a copy of list.scm, but with a
better name.
* module/Makefile.am: Add help.scm to the list.
* module/scripts/list.scm: Change to be an alias to "help".
(list-scripts): Restore this API.
* module/scripts/: Add %summary entries, and in many cases,
%include-in-guild-list entries to inhibit a script from appearing in
"guild list". Update list.scm to respect this new variable.
* module/scripts/PROGRAM.scm: Remove this useless template, which was
cluttering `guild list'. We'll perhaps cull the list a bit more in
2.2.
* module/Makefile.am: Adapt.
* module/scripts/list.scm (strip-extensions): Don't list programs
without extensions.
(main): Be prettier. Parse out a %summary from modules, for a brief
synopsis.
...by not using its own-rolled getopt, and moving the `list' function
to a separate script
* meta/guile-tools.in: Use (ice-9 getopt-long).
(directory-files, strip-extensions, unique, find-submodules,
list-scripts): Deleted (and moved to new `list.scm' file).
(getopt): Deleted.
(main): Use getopt-long. Default to calling the `list' script if no
script is specified.
* module/scripts/list.scm: New script.
* module/Makefile.am (SCRIPTS_SOURCES): Add list.scm.
* doc/ref/tools.texi (Executable Modules): Say "guile-tools modules"
instead of "executable modules". Remove obsolete statements about
not ending in .scm, being executable, and beginning with shell
script invocation sequence.
* module/scripts/README: Ditto.