* 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.
comments in ghil-lookup are pertinent.
* module/system/il/compile.scm (make-glil-var): Require that ghil vars
have environments. Remove the 'unresolved case -- we'll treat all
module-level variables as late bound.
* module/system/il/ghil.scm (ghil-lookup): Treat all module level vars as
late bound.
* module/system/vm/assemble.scm: Instead of vlink and vlate-bound, have
vlink-now and vlink-later.
(codegen): Add a bunch of crap to get the various cases right.
(object-assoc, dump-object!): Handle the new cases, remove the old
cases.
* src/vm_loader.c (link-now, link-later): Change from link and lazy-bind.
Include the module in which the link is to be done, so that callers
from other modules get the right behavior.
* src/vm_system.c (late-variable-ref, late-variable-set): Instead of a
sym, the unbound representation is a module name / symbol pair.
* testsuite/run-vm-tests.scm (run-vm-tests): Remove some debugging.
Fixes the mutually-recursive toplevel definitions case. This could be
fixed by rewriting bodies as letrecs, as r6 does, but that's not really
repl-compatible.
* module/system/il/ghil.scm (ghil-lookup): Ok, if we can't locate a
variable, mark it as unresolved.
* module/system/il/compile.scm (make-glil-var): Compile unresolved
variables as <glil-late-bound> objects.
* module/system/il/glil.scm: Add <glil-late-bound> definition.
* module/system/vm/assemble.scm (codegen): And, finally, when we see a
<vlate-bound> object, allocate a slot for it in the object vector,
setting it to a symbol. Add a new pair of instructions to resolve that
symbol to a variable at the last minute.
* src/vm_loader.c (load-number): Bugfix: the radix argument should be
SCM_UNDEFINED in order to default to 10.
(late-bind): Add an unresolved symbol to the object vector. Could be
replaced with load-symbol I guess.
* src/vm_system.c (late-variable-ref, late-variable-set): New
instructions to do late symbol binding.
* testsuite/Makefile.am (vm_test_files):
* testsuite/t-mutual-toplevel-defines.scm: New test, failing for some
reason involving the core even? and odd? definitions.
* module/system/il/compile.scm (make-glil-var): Only dump the module if
we actually have one.
* module/system/il/ghil.scm (ghil-define): Make sure that ghil-var-env is
a ghil-env.
* src/vm_loader.c (link):
* module/system/vm/assemble.scm (dump-object!): Rewrite `link' to take
two Scheme arguments on the stack: the symbol, as before, and the
module in which the symbol was found at compile time. This introduces
some undesireable early binding, but it does let the vm load up
modules, and (potentially) have multiple modules in one .go file. On a
practical level, I can now compile modules and have their .go files
load up the modules' dependencies as necessary.
* module/system/il/compile.scm (make-glil-var): Make the :mod of the
glil-var actually a guile module, not a ghil-env.
* module/system/il/ghil.scm (module-lookup, ghil-lookup): For module
variables, encode the location where we found the variable in the
ghil-var.
* module/language/scheme/translate.scm (trans):
* module/system/il/compile.scm (codegen): When making records where a
value can be a keyword, make sure to use the keyword initialization
form, so that the record initializer doesn't interpret the keyword as a
slot name.
* module/system/base/Makefile.am (vm_DATA): For now, don't compile
pmatch.
Before:
> ,c (set! x 3)
0 (make-int8 3) ;; 3
2 (link "x")
5 (variable-set)
> ,c (define x 3)
0 (make-int8 3) ;; 3
2 (link "x")
5 (variable-set)
After:
> ,c (define x 3)
0 (make-int8 3) ;; 3
2 (define "x")
5 (variable-set)
* src/vm_loader.c (link): `link' now errors if the variable is undefined.
This corresponds with desired behavior, for both `ref' and `set'
operations, for scheme. It's not what elisp wants, though. Perhaps
elisp linking needs another instruction.
(define): New instruction, the same as calling scm_define(), basically.
* module/language/scheme/translate.scm (trans-pair): Don't try to look up
an existing variable definition when translating `define'; instead use
the special-purpose lookup from ghil.scm's `ghil-define'.
* module/system/il/compile.scm (codegen): Compile to a different kind of
variable access from `set!', specifically via passing 'define as the op
to `make-glil-var'.
* module/system/il/ghil.scm (ghil-lookup): Don't add to the module table
when compiling variable sets via `set!'.
(ghil-define): New procedure, for looking up variables for `define'.
* module/system/vm/assemble.scm (<vdefine>): New record: a new
instruction type.
(codegen): Compile `define' module vars into <vdefine>.
(dump-object!): <vdefine> == `define'.
* module/system/base/syntax.scm (define-record): Rebase to implement on
top of Guile's records, which are the substrate of srfi-9's records.
(%compute-initargs): Rename from %make-struct, just return the list of
values.
(get-slot, set-slot!, slot): Removed, no longer used.
(record-case): Allow slots of the form (MYNAME SLOTNAME), which binds
SLOTNAME to MYNAME (instead of SLOTNAME to SLOTNAME).
(record-case, record?): No more ice-9 match!
* module/system/il/compile.scm (codegen): Tweaks so that the new record
code works.
* module/system/il/ghil.scm: Fix some slot references.
* module/system/vm/assemble.scm (preprocess, codegen): Remove calls to
`slot'.
(codegen): Fix some slot references.
* module/system/base/syntax.scm (define-record): Define the accessors as
procedures-with-setters, not just as getters.
* module/system/il/compile.scm (optimize): This function was bitrotten
since the addition of source locations in
cb4cca12e7. Untested attempts to
de-bitrot it. Dedottify as well.
* module/system/il/ghil.scm:
* module/system/il/glil.scm (unparse):
* module/system/vm/debug.scm (debugger-repl): Ongoing dedottification.
* module/system/base/syntax.scm (record-case): Capture the match macro.
* module/system/il/glil.scm:
* module/system/il/compile.scm: Convert to record-case.
* module/system/base/syntax.scm (define-record): Rework to separate the
type and its constructor. Now (define-record (<foo> bar)) will create
`make-foo' as the constructor, not `<foo>'. Also the constructor now
takes either keyword or positional arguments, so that it can be used as
the implementation of variant types as well.
(|): Map directly to define-record instead of rolling our own thing.
* module/language/scheme/translate.scm:
* module/system/base/language.scm:
* module/system/il/compile.scm:
* module/system/il/ghil.scm:
* module/system/il/glil.scm:
* module/system/repl/common.scm:
* module/system/vm/assemble.scm:
* module/system/vm/debug.scm: Change instances of record creation to use
the make-foo procedures instead of <foo>. Adjust module exports as
necessary.
* doc/guile-vm.texi: Documented the compiler (node `The Compiler').
Removed a number of things that might have been relevant to Guile-VM 0.0.
* module/system/il/compile.scm (optimize): Commented out the case
using `<ghil-inst?>'.
* src/vm_engine.c (vm_run)[objects_handle]: New variable.
Before leaving the function, release OBJECTS_HANDLE.
* src/vm_engine.h (CACHE_PROGRAM): Use `scm_vector_writable_elements'
instead of `scm_vector_elements'; don't release the handle right away.
* src/vm_loader.c (load-program): New commented out piece of code
dealing with simple vectors.
* src/vm_system.c (object-ref): Added the type of OBJNUM.
git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-3