* libguile/vm-engine.c (vm_run): Add another byte onto the bootstrap
program, as the offset passed to mv-call now takes two bytes.
* module/system/vm/frame.scm (bootstrap-frame?): Update for the new
bootstrap length. Really we should just check for 'halt though.
* libguile/vm-i-system.c (FETCH_OFFSET): New helper, used in BR().
(goto/nargs, call/nargs): Versions of goto/args and call, respectively,
that take the number of arguments from a value on the top of the stack.
(mv-call): Call FETCH_OFFSET to get the offset.
* module/language/scheme/translate.scm (custom-transformer-table):
Compile call-with-values to <ghil-mv-call>. There is some trickery
because of the r4rs.scm call-with-values trampolines.
* module/system/il/ghil.scm: Add <ghil-mv-call> and accessors.
* module/system/il/compile.scm (codegen): Compile <ghil-mv-call>.
* module/system/il/glil.scm: Add <glil-mv-call>, which needs some special
assembly because of the label. Fix some typos.
* module/system/vm/assemble.scm (byte-length): New helper, factored out
and made more general.
(codegen): Assemble mv-call, including the label.
(check-length): New helper, makes sure that the addressing is
consistent within the produced object code.
(stack->bytes): Rewrite to be more generic -- now `br' instructions
aren't the only ones jumping around in the instruction stream.
* module/system/vm/conv.scm (make-byte-decoder): Return two values in the
#f case.
* module/system/vm/disasm.scm (disassemble-bytecode): Rewrite, because
the previous implementation depended on a guile interpreter quirk:
namely, that multiple values could be represented within one value, and
destructured later.
* libguile/vm-engine.c (vm_run): Move nvalues to the top level, to avoid
(spurious, it seems) gcc warnings about it being used uninitialized.
* libguile/vm-i-system.c (halt, return/values): Adapt to gcc silliness.
Deindent some of return/values.
(return/values*): New instruction, does what (apply values . args)
would do.
* module/language/scheme/translate.scm (custom-transformer-table): Move
the apply and @apply cases here from inline.scm, because we need some
more cleverness when dealing with cases like (apply values . args).
(lookup-apply-transformer): Define an eval transformer for `values',
turning it into ghil-values*.
* module/system/il/compile.scm (codegen): Compile <ghil-values*> into
return/values*.
* module/system/il/ghil.scm: Add <ghil-values*> and accessors.
(ghil-lookup): Add optional argument, define?, which if false tells us
not to actually cache the binding if it is not found in the toplevel.
* module/system/il/inline.scm: Remove apply clauses.
* module/system/vm/frame.scm (bootstrap-frame?): Update heuristic for
bootstrap-frame?, as the bootstrap frame is now 5 bytes since it
accepts multiple values.
* libguile/vm-engine.c (vm_run): The bootstrap program now uses mv_call,
so as to allow multiple values out of the VM. (It did before, because
multiple values were represented internally as single scm_values
objects, but now that values go on the stack, we need to note the boot
frame as accepting multiple values.)
(vm_error_no_values): New error, happens if you pass no values into a
single-value continuation. Passing more than one is OK though, it just
takes the first one.
* libguile/vm-i-system.c (halt): Assume that someone has pushed the
number of values onto the stack, and package up that number of values
as a scm_values() object, for communication with the interpreter.
(mv-call): New instruction, calls a procedure with a multiple-value
continuation, even handling calls out to the interpreter.
(return/values): New instruction, returns multiple values to the
continuation. If the continuation is single-valued, takes the first
value or errors if there are no values. Otherwise it returns to the
multiple-value return address, pushing the number of values on top of
the values.
* module/system/il/compile.scm (codegen): Compile <ghil-values> forms.
* module/system/il/ghil.scm (<ghil-values>) Add new GHIL data structure
and associated procedures.
* module/language/scheme/translate.scm (custom-transformer-table):
Compile (values .. ) forms into <ghil-values>.
* libguile/vm-i-system.c (call): Rename continuation invocation from
`vm_call_cc' to `vm_call_continuation', because that's what it really
does. Add a note that it doesn't handle multiple values at the moment.
(goto/arg): Renamed from tail-call, in deference to the progenitors, on
Dale Smith's suggestion.
(goto/apply): New instruction, for `apply' in a tail context. Not yet
used, or vetted for that matter.
(call/cc): No need to pop the program, I don't think; although this
isn't tested either.
(goto/cc): New instruction, for call/cc in a tail context.
* module/language/scheme/translate.scm (*forbidden-primitives*): Rename
from %forbidden-primitives.
* module/system/il/compile.scm (codegen): Adapt to goto/args instead of
tail-call.
* module/system/il/inline.scm: Start inlining some macros used in
r4rs.scm -- not yet fully tested.
* ice-9/boot-9.scm: Allow load of a compiled r4rs file.
* module/system/vm/program.scm (program-bindings-as-lambda-list): Handle
the bindings-is-null case too -- not sure how it comes about, though. A
thunk with no let, perhaps.
(write-program): Another default for the name: the source location at
which it was defined.
* libguile/programs.c (program_print): Add some "logic" to stop doing
detailed prints if one print had a nonlocal exit -- preventing
exceptions in backtraces.
* module/system/vm/frame.scm (frame-call-representation)
(frame-program-name): Rename program-name to frame-program-name, and
use the program-name if it is available.
* module/system/vm/program.scm (program-bindings): Return #f if there are
no bindings.
(program-name): New public procedure.
(program-bindings-as-lambda-list, write-program): A more useful writer
for programs.
* libguile/programs.c (scm_bootstrap_programs, program_print): Add a smob
printer for programs, which dispatches to `write-program'.
* module/system/il/compile.scm (codegen): Fix *another* bug in compiling
`or' -- in the case in which the value was being discarded, as in `or'
used as a control structure, we were sometimes leaving a value on the
stack.
* testsuite/t-or.scm: Add another test case for `or'.
* 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/language/scheme/spec.scm (scheme): Specify an evaluator, `eval'.
* module/system/repl/common.scm (repl-default-options): Add option,
`interp', specifying that, if possible, the repl should interpret its
expressions rather than compile them. Defaults to #f.
* libguile/programs.h (struct scm_program):
* libguile/programs.c (scm_c_make_program): Record the current module
when making a program. This replaces the per-late binding recorded
module in the generated code, which should be more efficient, both in
terms of garbage, and in not calling resolve-module.
(program-module): New accessor.
* module/system/vm/program.scm: Add program-module to exports.
* libguile/vm-i-loader.c (link-later): Remove this instruction, since now
the entry in the object table is just a symbol, and can be loaded with
load-symbol.
* libguile/vm-i-system.c (late-variable-ref, late-variable-set): Rework
so as to look up in the module of the current program. The logic could
be condensed quite a bit if scm_module_lookup () knew what to do with
mod==#f.
* module/system/vm/assemble.scm (dump-object!): Dump <vlink-later> just
as load-symbol, as mentioned in the note on link-later.
* module/system/il/ghil.scm: Update comment to reflect the new reality.
* 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/vm/assemble.scm (make-meta, codegen): Hide the "meta"
information -- the names of the bindings, source info, procedure
properties, etc -- behind a lambda. This way, loading up a program
conses less, because the metadata stays as mmap'd code until it is
needed.
* libguile/vm-i-loader.c (load-program): Adjust load-program to expect
the metadata to be a program.
* module/system/vm/program.scm (program-bindings, program-sources)
(program-properties): Adjust to new meta format.
* module/system/il/compile.scm (constant?, codegen): Add some diagnostics
so that we can get decent error reporting if we accidentally unquote an
unreadable value into the compiled output.
* module/system/il/ghil.scm (<ghil-env>, <ghil-toplevel-env>): Refactor
so that all environments point (eventually) at one toplevel
environment. Instead of having potentially multiple toplevel
environments, each noting the module against which its bindings are
resolved, have each binding in the toplevel record what module it
should be resolved in. Should fix compilation units that define
multiple modules.
(ghil-lookup, ghil-define): Reworked to not be destructive. Module
variables now have the module name as their "env", and are keyed as
`(MODNAME . SYM)' in the var table.
(call-with-ghil-environment): Reindented.
* module/system/il/inline.scm (try-inline-with-env): Adapt to
env/toplevel changes.
* module/system/vm/assemble.scm (dump-object!): A vlink-later now holds
the module name, not the module itself.
* module/system/il/compile.scm (make-glil-var): The "env" of a "module"
var is now the module name, not the module.
* module/language/scheme/translate.scm (primitive-syntax-table): Update
the way we test for toplevel environments. Reindent the lambda
translator.
(lookup-transformer, trans): lookup-transformer now has 2 args, not 3.
(translate): Update the way we make toplevel environments.
* module/system/vm/frame.scm (frame-call-representation): Show more of
lists.
(program-name): Avoid a traceback if (frame-address link) is #f. Not
sure when this can happen, but it does, and since this is already in
the backtrace function, there be badness there.
* libguile/vm-i-loader.c (load-program):
* module/system/vm/assemble.scm (dump-object!): There are cases in which
we use the 16-bit representation for program params (nargs, nexts,
etc), but the actual 16-bit number actually fits into 8 bits -- which
is then misinterpreted by the loader as the 8-bit form. So ditch the
8-bit form entirely (it was never much of an optimization), and just
use the 16-bit form. Make sure to clear out all your .go files before
recompiling this one!
Thanks to Dale Smith.
* guilec.mk: Rework to expect the includer to define $(modpath), then
make $(moddir) from that.
* module/language/Makefile.am:
* module/language/scheme/Makefile.am:
* module/system/base/Makefile.am:
* module/system/il/Makefile.am:
* module/system/repl/Makefile.am:
* module/system/vm/Makefile.am: Define modpath instead.
* src/guilec.in: Don't import (system vm bootstrap), it is no more.
* ice-9/boot-9.scm: Only define load-compiled as #f if it's not already
defined, which won't normally be the case.
* libguile/guile-vm.c: Removed, there's no more guile-vm binary.
* libguile/frames.c: (with change frame? -> heap-frame?)
* libguile/frames.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/objcodes.c:
* libguile/objcodes.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/vm-bootstrap.h: (was bootstrap.h)
* libguile/vm-engine.c: (was vm_engine.c)
* libguile/vm-engine.h: (was vm_engine.h)
* libguile/vm-expand.h: (was vm_expand.h)
* libguile/vm-i-loader.c: (was vm_loader.c)
* libguile/vm-i-scheme.c: (was vm_scheme.c)
* libguile/vm-i-system.c: (was vm_system.c)
* libguile/vm.c:
* libguile/vm.h: These files moved here from src/, as guile-vm is now a
part of libguile.
* libguile/init.c: Bootstrap the VM. Yay!
* libguile/Makefile.am: The necessary chicanery here.
* module/system/vm/Makefile.am:
* module/system/vm/bootstrap.scm:
* module/system/vm/frame.scm:
* module/system/vm/instruction.scm:
* module/system/vm/objcode.scm:
* module/system/vm/program.scm:
* module/system/vm/vm.scm:
* pre-inst-guile-env.in: Add builddirs to the load path; add module/ to
the path in the empty-$GUILE_LOAD_PATH case as well.
* src/Makefile.am: Moved out everything except guilec and guile-disasm,
which probably should be moved to the scripts directory?
* testsuite/Makefile.am: Update to find guile-vm in the right place.
* module/system/vm/Makefile.am:
* module/system/vm/bootstrap.scm: Removed bootstrap.scm, scm_init_guile
handles the bootstrapping for us.
* module/system/vm/frame.scm:
* module/system/vm/instruction.scm:
* module/system/vm/objcode.scm:
* module/system/vm/program.scm:
* module/system/vm/vm.scm: Call the init functions in libguile; should
fix at some point to avoid the dlopen?
* src/Makefile.am:
* src/envs.c:
* src/envs.h: Remove the envs code, which was historically used to
implement modules. But since we use Guile's modules, these aren't
necessary.
* src/vm.c:
* src/vm_loader.c:
* module/system/vm/assemble.scm: Remove code bits that trafficked in yon
deprecation.
* module/system/repl/command.scm (display-time-stat, display-mips-stat):
Always convert to float.
* module/system/vm/frame.scm (print-frame): Write the args, don't display them.
* module/system/repl/command.scm (statistics): gc-sweep-time is no more.
* 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/base/compile.scm (call-with-output-file/atomic): New
proc, outputs to a tempfile then does an atomic rename. Prevents SIGBUS
if a compiled file is truncated and rewritten, as the file's objcode is
mmap'd in.
(compile-file): Use the new helper.
* 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.
* src/vm_engine.c (vm_run):
* src/programs.c (scm_c_make_program): If the holder is #f, malloc *and*
copy the bytecode.
* module/system/vm/frame.scm (bootstrap-frame?): Now that we actually
heapify the bootstrap program, we can check for `halt' in the bytecode.
* 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/il/compile.scm (codegen): The currently-executing
instruction is actually the one right before the instruction pointer;
so for purposes of assv to find a source location for an ip, put the
source after the code, as it was before.
* module/system/vm/debug.scm (vm-backtrace): Move more code to frame.scm.
* module/system/vm/frame.scm (make-frame-chain): Include all frames, even
the bootstrap one. For a reentrant backtrace we'll have boostrap
programs anyway. Probably should check for objcode[2] == scm_op_halt,
to not show those frames in the trace.
(frame-line-number, frame-file): New helpers.
(print-frame): Print out the line number too.
(frame-call-representation): Code from print-frame-call moved here.
(print-frame-chain-as-backtrace): A backtrace printer, yays.
(program-name): Check link validity before calling frame-address on it.
* module/system/vm/program.scm (source:addr, source:line, source:column)
(source:file): New accessors for the elements of program-sources.
* module/system/vm/vm.scm (vm:last-ip): New export.
(vm-last-frame-chain): Use vm:last-ip in making the frame chain.
* src/vm.h (struct scm_vm):
* src/vm.c (make_vm, scm_vm_last_ip, scm_vm_save_stack): Save the last
instruction pointer when saving the stack. Really though, we should be
saving all of the stack data on a spaghetti stack.
* src/vm_system.c (late-variable-ref): Pointless s/REGISTER/BEFORE_GC/.
* module/system/vm/disasm.scm (disassemble-program, disassemble-meta):
Disassemble program meta information too, if it's there.
* src/vm_system.c (variable-set): Don't try to proxy name information;
maybe we can do this later, but the code as it was was calling SCM_CAR
on a variable, which is for the lose.
* module/system/repl/command.scm: Coerce rationals to floats.
* module/system/vm/program.scm (program-documentation): Fix a typo, doh!
* src/vm.c (vm_reset_stack, struct vm_unwind_data): Add unwind handler to
reset vp->sp, vp->fp, and vp->this_frame when performing a nonlocal
exit from a vm_run.
(vm_heapify_frames_1): Don't repack the stack, it causes stack
corruption. I think we need spaghetti stacks to handle continuations,
not separate heap frames. I don't think call/cc is working now.
(vm-save-stack): Don't call heapify_frames, that modifies the stack
that we're copying. Instead call its helper, heapify_1.
* src/vm_engine.c (vm_run): Set up the vm_reset_stack unwind handler.
* src/vm_engine.h (IP_REG, SP_REG, FP_REG): If we got through all of the
checks without having these macros defined, define them as empty.
Happens on x86-64.
* src/vm_system.c (halt): End the dynwind before we return from the VM.
* src/vm_scheme.c (REL): Sync the regs before calling scm_lt_p et al,
cause they can do a nonlocal exit.
* 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.
* benchmark/measure.scm: Update for module changes.
* module/system/vm/Makefile.am: Update the set of modules needing
compilation.
* src/guile-vm.c: Bootstrap the VM, now that we have a function for it.
* testsuite/Makefile.am:
* testsuite/run-vm-tests.scm: Update to fix make check, broken since we
merged with Guile.
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.
* m4/labels-as-values.m4: New file, checks for computed goto.
* configure.in: Use AC_C_LABELS_AS_VALUES.
* module/system/repl/command.scm (procedure-documentation): Extend the
core's procedure-documentation in an ad-hoc way, so that ,help works.
* module/system/vm/core.scm (program-properties): New function.
(program-documentation): New function.
* src/vm_engine.h (DROP, DROPN): Decrement sp before checking for
underflow.
* src/vm_system.c (call, tail-call): Add some optimized dispatch for some
C functions, so that we can avoid consing and the interpreter if
possible. However currently it seems that I'm always getting the
scm_call_* trampolines back.
* module/language/scheme/translate.scm (translate): Adapt to lambda
having a `meta' slot now.
(primitive-syntax-table, parse-lambda-meta): Parse out a docstring from
lambda forms, putting in the <ghil-lambda>'s meta slot.
* module/system/il/compile.scm (optimize, codegen): Passthrough for the
`meta' slot to the <glil-asm> object.
* module/system/il/ghil.scm (<ghil-lambda>): Add meta slot.
* module/system/il/glil.scm (<glil-asm>): Add meta slot.
(unparse): Unparse meta.
* module/system/vm/assemble.scm (preprocess): Pass through the meta slot.
(codegen): So, set the bytespec's meta slot as a list: bindings, source
info, then the tail is the meta-info, which should be an alist.
Currently the only defined key is `documentation', but `name' could
come in the future.
* module/system/vm/core.scm (program-sources): Sources are now in the
cadr...
(program-property): And here we have access to the cddr.
* module/language/scheme/translate.scm (translate, trans)
(make-pmatch-transformers): When recursing into subexpressions, get the
appropriate source location information.
(location): Include the source filename in the location information.
* module/system/il/compile.scm (codegen): Record source locations in more
cases. (This information ends up being part of the procedure metadata,
not the actual codepath.)
* module/system/il/glil.scm (unparse): Don't destructure the source
locations (it's a vector now).
* 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.
* guilec.mk: New file, to be included when building .go files.
* module/language/scheme/Makefile.am:
* module/system/base/Makefile.am:
* module/system/il/Makefile.am:
* module/system/repl/Makefile.am:
* module/system/vm/Makefile.am: Use guilec.mk.
* module/system/base/compile.scm (compiled-file-name): Work on the
basename of a file, so that we always create files in the directory
where we run. Perhaps should add a -o option to guilec in the future.
* Makefile.am: Actually recurse into module/ in a normal build.
* 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/describe.scm (format-documentation): Remove bad
string syntax. This file doesn't compile though, due to define-macro
being a procedure->syntax macro.
* module/language/scheme/translate.scm (lookup-transformer): Allow for
undefined variables when doing the transformation -- it's possible that
they come from a module definition's forward declaration.
* module/system/repl/command.scm (import): Make into legal Scheme, caught
by the compiler :-)
* module/system/vm/assemble.scm (<vlink-now>): Remove the module field.
Immediate bindings will now always be relative to the current module.
Fixes some mess about process-define-module not being defined when
loading modules, probably because we destructively modified the
ghil-env.
(codegen, dump-object!): Don't dump a module name.
* src/vm_loader.c (link-now): Just use scm_lookup.
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/language/scheme/translate.scm (lookup-transformer): When
expanding syncase macros, use the eval closure from the ghil-env.
Probably doesn't make any difference whatsoever.
* module/system/base/Makefile.am (SOURCES): Compile pmatch.scm, now that
it works :-))
* module/system/base/compile.scm (compile-in): Compile inside a
save-module-excursion, so that side effects of evaluation don't leak
out.
* module/system/base/pmatch.scm: Change from :use-syntax/:export-syntax
to simply :use-modules/:export. Also probably has no effect.
* module/system/il/ghil.scm (fix-ghil-mod!): Suppress warnings resulting
from compilation of define-module.
* src/vm_loader.c (link): So, referencing variables defined but not
exported from the current module didn't work. Fixed that, but it's
hacky. There are still some uncaught cases.