* ice-9/boot-9.scm (@, @@): Note that these don't work with the compiler.
Damn.
(top-repl): Run the VM repl. Whooo!
* module/system/repl/repl.scm (start-repl): Catch 'quit, as the
scm-style-repl does. Newline after input EOF's, so that we don't leave
the user's shell messed up.
* module/system/base/syntax.scm (keywords): Don't enable :keywords, it
breaks code that may assume that ':foo is a symbol, like boot-9.
* module/*.scm: Don't use :keywords, use #:keywords. The user can decide
if she wants #:keywords in their .guile, and :keywords might make us
compile modules differently.
* module/system/repl/command.scm (module): Accept e.g. `,m ice-9 popen'
in addition to `,m (ice-9 popen)'.
* module/system/repl/repl.scm (start-repl): Call read with a backtrace
handler too.
* module/system/il/compile.scm (codegen): Rewrite handling of `and' and
`or' ghil compilation, because it was broken if drop was #t. Tricky
bug, this one! Took me days to track down!
* module/system/repl/repl.scm: Export call-with-backtrace, which probably
should go in some other file.
* src/vm.c (scm_vm_save_stack): Handle the fp==0 case for errors before
we have a frame.
* src/vm_engine.h (NEW_FRAME, FREE_FRAME): Stricter underflow checking,
raising the stack base to the return address, in an attempt to prevent
inadvertant stack smashing (the symptom of the and/or miscompilation
bug).
(CHECK_IP): A check that the current IP is within the bounds of the
current program. Not normally compiled in. Perhaps it should be?
* src/vm_system.c (halt): Set vp->ip to NULL. Paranoia, I know.
(return): Call CHECK_IP(), if such a thing is compiled in.
* testsuite/Makefile.am (vm_test_files):
* testsuite/t-catch.scm:
* testsuite/t-map.scm:
* testsuite/t-or.scm: New tests.
* module/system/repl/repl.scm (default-catch-handler): Cosmetic
improvements on VM error backtraces.
* module/system/vm/frame.scm (print-frame): Cosmetic improvements.
(frame-line-number): source:line operates on the handle, not the cdr.
(print-frame-chain-as-backtrace): Cosmetic improvements.
* module/system/repl/repl.scm: Remove a useless print in the backtrace
handler.
* module/system/vm/debug.scm (vm-backtrace): s/reverse!/reverse/
* module/system/vm/frame.scm (bootstrap-frame?): A heuristic to see if a
frame is a bootstrap frame, the one allocated on the stack in
vm_engine.c; need to have a better solution for this.
(make-frame-chain): Don't include bootstrap frames, they add no
information.
(print-frame-chain-as-backtrace): Remove a pk.
* src/vm_engine.c (vm_run): Add a fixme about the bootstrap prograp.
* module/system/repl/repl.scm (default-pre-unwind-handler): Save the VM
stack in addition to the interpreter stack. At some point these
functions should know about each other, I guess.
(default-catch-handler): Show the VM stack too. Needs a bit of work.
* module/system/vm/frame.scm: Export make-frame-chain.
* module/system/vm/vm.scm: Export vm-save-stack.
* src/vm.c (scm_vm_save_stack): New function, heapifies the current
stack, saving it to vm->last_frame.
* src/vm_engine.c (vm_run:vm_error): Don't heapify frames here, because
nonlocal exits avoid this code entirely. Instead rely on the user
saving the stack with a pre-unwind handler, as the repl does.
This reorganization kills the ugly module-export-all hacks in
bootstrap.scm and core.scm. In fact, it gets rid of core.scm entirely,
breaking out its functionality into separate files.
* module/system/vm/trace.scm:
* module/system/vm/profile.scm:
* module/system/vm/disasm.scm:
* module/system/vm/debug.scm:
* module/system/vm/conv.scm:
* module/system/vm/assemble.scm:
* module/system/repl/repl.scm:
* module/system/repl/common.scm:
* module/system/base/compile.scm:
* module/system/repl/command.scm: Update for changes, and fix a bug in
procedure-documentation.
* module/system/vm/bootstrap.scm: Just call scm_bootstrap_vm, which
handles setting load-compiled for us.
* module/system/vm/core.scm: Removed, functionality folded into other
modules.
* module/system/vm/frame.scm: Export the C frame procedures here; also
move scheme functions from core.scm here.
* module/system/vm/instruction.scm: New file, exports procedures from
instructions.c.
* module/system/vm/objcode.scm: New file, exports procedures from
objcodes.c.
* module/system/vm/program.scm: New file, exports procedures from
programs.c, and some scheme functions originally from core.scm.
* module/system/vm/vm.scm: New file, from vm.c and core.scm.
* src/Makefile.am (libguile_vm_la_SOURCES): Add bootstrap.h.
* src/bootstrap.h: New file, prototypes scm_bootstrap_vm (), which the
scm_init_* functions call.
* src/frames.h:
* src/frames.c (scm_init_frames):
* src/frames.c (scm_bootstrap_frames):
* src/vm.h:
* src/instructions.h:
* src/instructions.c (scm_init_instructions):
* src/instructions.c (scm_bootstrap_instructions):
* src/objcodes.h:
* src/objcodes.c (scm_bootstrap_objcodes):
* src/objcodes.c (scm_init_objcodes):
* src/programs.h:
* src/programs.c (scm_bootstrap_programs):
* src/programs.c (scm_init_programs):
* src/vm.c (scm_bootstrap_vm):
* src/vm.c (scm_init_vm): Call scm_bootstrap_vm() before doing anything
in an init function. Bootstrap_vm will call bootstrap_instructions(),
etc to initialize types, then set load-compiled to point to
load-compiled/vm.
* src/vm.c (scm_load_compiled_with_vm): Code to load .go files, if
they're present.
* module/system/il/inline.scm: New module, implements generic inlining of
scheme functions. It even does the right thing regarding (define
arity:nopt caddr) and such. So now there are many more inlines: the
arithmetics, `apply', the caddr family, etc. This makes the benchmarks
*much* faster.
* module/language/scheme/translate.scm (trans): Remove the
%scheme-primitives code in favor of the generic (scheme il inline)
code. Adds inlining for +, -, =, etc.
* src/vm.c (vm_puts): Fix to work.
* module/system/base/compile.scm (system): Export load/compile also.
* module/system/il/compile.scm (optimize): Further debitrotting, but I
haven't tried this function yet. It seems that <ghil-inst> was what
<ghil-inline> is.
* module/system/il/ghil.scm (*core-primitives*, *macro-module*)
(ghil-primitive-macro?, ghil-macro-expander, ghil-primitive?): Remove
these unused things.
* module/system/il/macros.scm: Removed, replaced with inline.scm.
* module/system/vm/assemble.scm (stack->bytes): Before, the final
serialization code did an (apply u8vector (apply append (map
u8vector->list ...))). Aside from the misspelling of append-map, this
ends up pushing all elements of the u8vector on the stack -- assuredly
not what you want. But besides even that, I think that pushing more
than 32k arguments on the stack brings out some other bug that I think
was hidden before, because now we actually use the `apply' VM
instruction. Further testing is needed here, I think. Fixed the code to
be more efficient, which fixes the manifestation of this particular
bug: a failure to self-compile after inlining was enabled.
* module/system/vm/bootstrap.scm: New module, serves to bootstrap
boot-9's `load-compiled'. That way when we load (system vm core), we're
loading compiled code already.
* module/system/vm/core.scm: Use (system vm bootstrap).
* src/guilec.in: Use the bootstrap code, so that we really are compiling
with an entirely compiled compiler.
* module/system/repl/repl.scm (default-catch-handler): An attempt at
making the repl print a backtrace; more work needed here.
* module/system/vm/frame.scm (make-frame-chain): Fix some misspellings --
I think, anyway.
* module/language/scheme/translate.scm (*the-compile-toplevel-symbol*):
Reset to compile-toplevel, which requires a patch to guile.
* module/system/base/compile.scm (compile-file): Some foo so that we load
up the scheme language before call-with-output-file. Fixes compilation
of (language scheme) modules.
* module/system/base/language.scm (define-language): Don't unquote in
make-language; refer to it by name instead, and export it.
* module/system/repl/Makefile.am (vm_DATA): Don't compile describe.scm,
because we really can't deal with goops yet.
* module/system/repl/repl.scm (compile-toplevel): If we're compiling, put
in a stub definition of start-stack, which is closely tied to the
interpreter.
* src/vm_loader.c (load-program): Fix a very tricky corruption bug!
* module/system/repl/repl.scm (default-pre-unwind-handler)
(default-catch-handler): New procedures, to do some error handling in
the repl.
(start-repl): Catch errors in the repl loop.
* module/system/base/compile.scm (<cenv>): No more cenv, it was a useless
data structure.
* module/system/repl/command.scm (*command-table*): Remove `use', it's
the same as `import'. Otherwise in this file, adapt to the repl having
direct pointers to the vm and the language, and to the module being in
the current-module fluid.
* module/system/repl/repl.scm (prompting-meta-read):
* module/system/repl/common.scm (<repl>): The repl now has a direct
pointer to the vm and language. Adapt accordingly.
* module/system/repl/common.scm (repl-prompt): Return a string instead of
outputting to the port, for better readline integration.
* module/system/repl/repl.scm (meta-reader, prompting-meta-read)
(start-repl): Integrate with (ice-9 readline) via the current-reader
fluid and the repl-reader function, both from boot-9.scm.
* module/system/repl/command.scm (system): Declare exports in the module
declaration.
* module/system/repl/repl.scm (start-repl): If the evaluation returns
multiple values, print them separately.