bpt/guile.git
16 years ago`link' instruction links to symbols by module
Andy Wingo [Thu, 15 May 2008 11:55:33 +0000 (13:55 +0200)]
`link' instruction links to symbols by module

* 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.

16 years agoremove some debugging info
Andy Wingo [Thu, 15 May 2008 11:03:47 +0000 (13:03 +0200)]
remove some debugging info

* module/system/vm/assemble.scm: remove a pk

16 years agopush the module resolution info for variables down into glil
Andy Wingo [Thu, 15 May 2008 11:03:10 +0000 (13:03 +0200)]
push the module resolution info for variables down into glil

* 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.

16 years agofix dumping of #:keywords
Andy Wingo [Thu, 15 May 2008 10:20:18 +0000 (12:20 +0200)]
fix dumping of #:keywords

* 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.

16 years agoallow interpretation of load-toplevel as compile-toplevel
Andy Wingo [Thu, 15 May 2008 09:17:00 +0000 (11:17 +0200)]
allow interpretation of load-toplevel as compile-toplevel

* module/language/scheme/translate.scm (*the-compile-toplevel-symbol*)
  (primitive-syntax-table): Existing eval-case invocations in boot-9.scm
  only have `load-toplevel', not `load-toplevel' and `compile-toplevel'
  as they should. Allow for interpreting `load-toplevel' as
  `compile-toplevel'.

16 years agorework eval-case handling to be like cl's eval-when
Andy Wingo [Wed, 14 May 2008 22:38:31 +0000 (00:38 +0200)]
rework eval-case handling to be like cl's eval-when

* module/language/scheme/translate.scm (trans): Remove the hacky case for
  the unspecified value, not needed any more.
  (primitive-syntax-table): Rework eval-case to understand
  compile-toplevel and evaluate contexts, as in common lisp's eval-when:
  http://www.lisp.org/HyperSpec/Body/speope_eval-when.html
  This is the Right Thing.

16 years agofix use-syntax / use-modules confusion -- fixes testsuites
Andy Wingo [Wed, 14 May 2008 12:54:52 +0000 (14:54 +0200)]
fix use-syntax / use-modules confusion -- fixes testsuites

* testsuite/t-match.scm:
* testsuite/t-records.scm: While the attempt to redefine use-syntax as
  being "use during compilation" was cute, it does not reflect the
  historical usage of use-syntax, nor does it correspond to existing code
  that includes other modules and uses them during compilation.

  So use-syntax has been replaced with use-modules. The test suites now
  pass. In the future, compilation phases should be done on whole
  modules, I think; r5rs-style computation does not have phases.

16 years agofix macro compilation via hooking into eval-case
Andy Wingo [Wed, 14 May 2008 12:47:29 +0000 (14:47 +0200)]
fix macro compilation via hooking into eval-case

* module/language/scheme/translate.scm (eval-at-compile-time)
  (&compile-time-module, expand-macro): Remove this attempt at dealing
  with macros. Instead, we're going to rely on macros being first-class,
  and just catch eval-case at the bottom.
  (lookup-transformer): Lookup all syntax transformers in the module's
  eval closure. We catch the primitive-macros, compiling them to ghil,
  and expand the rest.
  (lookup-transformer): Fold in trans-pair here. Add a hacky case for the
  unspecified value; the problem shows up when compiling e.g.
  (define-macro (plus! x) `(set! ,x (1+ x))), as a fallout from
  eval-case.
  (make-pmatch-transformers, primitive-syntax-table): Define the
  primitive syntax transformers as a data-driven table instead of a
  function. There's a bit of syntax, too. Eval-case was rewritten to use
  pmatch.

* module/system/base/compile.scm (scheme): Define as a thunk instead
  of a value, so as to allow (language scheme translate) to be imported
  in the repl. Still, a hack.

16 years ago(void) -> (begin)
Andy Wingo [Wed, 14 May 2008 09:19:06 +0000 (11:19 +0200)]
(void) -> (begin)

* module/language/scheme/translate.scm (expand-macro, trans-pair): Remove
  support for the scheme form, '(void). Replace it by (begin). What was
  Keisuke thinking? :)

16 years agoremove x.foo.bar -> (slot x 'foo 'bar) compile-time translation
Andy Wingo [Wed, 14 May 2008 09:13:00 +0000 (11:13 +0200)]
remove x.foo.bar -> (slot x 'foo 'bar) compile-time translation

* module/language/scheme/translate.scm (trans): Remove compile-time dot
  expansion.

16 years agofix env script
Andy Wingo [Mon, 12 May 2008 22:13:56 +0000 (00:13 +0200)]
fix env script

* env: Fix env script to find $top_srcdir correctly

16 years agoUpdate Makefile.am's; remove slib import
Andy Wingo [Mon, 12 May 2008 22:07:40 +0000 (00:07 +0200)]
Update Makefile.am's; remove slib import

* Makefile.am:
* module/Makefile.am:
* module/language/scheme/Makefile.am:
* module/system/Makefile.am:
* module/system/base/Makefile.am:
* module/system/il/Makefile.am:
* module/system/repl/Makefile.am:
* module/system/vm/Makefile.am: Cleaned up to be more complete, if not
  completely working.

* module/guile/slib.scm:
* module/slib/: Removed the slib import; it's a bit out of place here,
  and bitrotten at that.

16 years agoadd env script
Andy Wingo [Mon, 12 May 2008 21:39:25 +0000 (23:39 +0200)]
add env script

* env: New file, run as ./env guile

16 years agocatch errors in the repl, with poor backtraces
Andy Wingo [Mon, 12 May 2008 21:27:14 +0000 (23:27 +0200)]
catch errors in the repl, with poor backtraces

* 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.

16 years agoreplace cenv with things in <repl> and fluids; remove the `use' meta-command
Andy Wingo [Mon, 12 May 2008 20:26:31 +0000 (22:26 +0200)]
replace cenv with things in <repl> and fluids; remove the `use' meta-command

* 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.

16 years agofixes so that typing asdfadfasff in the repl doesn't error
Andy Wingo [Sun, 11 May 2008 22:22:36 +0000 (00:22 +0200)]
fixes so that typing asdfadfasff in the repl doesn't error

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'.

16 years agoonly allow `define' at toplevel
Andy Wingo [Sun, 11 May 2008 20:37:35 +0000 (22:37 +0200)]
only allow `define' at toplevel

* module/language/scheme/translate.scm (trans-pair): Add a guard to only
  allow `define' at the top level; other defines are already filtered out
  via trans-body.

* module/system/il/ghil.scm (ghil-env-toplevel?): Export, and fix.

16 years agoremove define-private
Andy Wingo [Sun, 11 May 2008 20:03:50 +0000 (22:03 +0200)]
remove define-private

* module/language/scheme/translate.scm: Remove define-private.

16 years agoexplicitly list exports instead of using define-public
Andy Wingo [Sun, 11 May 2008 20:00:34 +0000 (22:00 +0200)]
explicitly list exports instead of using define-public

* module/system/base/compile.scm:
* module/system/il/ghil.scm:
* module/system/repl/describe.scm:
* module/system/vm/core.scm:
* module/system/vm/frame.scm:
* module/system/vm/trace.scm: Explicitly list exports in the module
  declaration instead of using define-public.

16 years ago<foo>? -> foo?; some exports cleanups
Andy Wingo [Sun, 11 May 2008 19:48:10 +0000 (21:48 +0200)]
<foo>? -> foo?; some exports cleanups

* module/system/base/compile.scm: Export cenv? also.

* module/system/base/syntax.scm: Clean up vestiges of the old structure
  code. Make accessors defined as foo? instead of <foo>?.

* module/system/il/glil.scm:
* module/system/il/ghil.scm: Remove <foo>-1 accessors, since we have
  named accessors.

16 years agopmatchify a cond for prettiness
Andy Wingo [Sun, 11 May 2008 19:30:02 +0000 (21:30 +0200)]
pmatchify a cond for prettiness

* module/language/scheme/translate.scm: pmatchify, it's prettier.

16 years agofix to meta-reader's optional port argument
Andy Wingo [Sun, 11 May 2008 18:53:47 +0000 (20:53 +0200)]
fix to meta-reader's optional port argument

* module/system/repl/repl.scm (meta-reader): Make the generated read
  procedure accept a port argument.

16 years agoice-9 history integration
Andy Wingo [Fri, 9 May 2008 11:21:23 +0000 (13:21 +0200)]
ice-9 history integration

* module/system/repl/repl.scm (start-repl): (ice-9 history) integration
  via the before-eval-hook and the before-print-hook.

16 years agoreadline integration for guile-vm
Andy Wingo [Fri, 9 May 2008 11:15:15 +0000 (13:15 +0200)]
readline integration for guile-vm

* 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.

16 years agomore exports cleanups
Andy Wingo [Fri, 9 May 2008 10:14:15 +0000 (12:14 +0200)]
more exports cleanups

* module/system/repl/common.scm: Declare exports in the module
  declaration.

16 years agomultiple-values help for the repl; exports cleanups
Andy Wingo [Fri, 9 May 2008 10:08:06 +0000 (12:08 +0200)]
multiple-values help for the repl; exports cleanups

* 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.

16 years agoReplace ice-9 match's structures with guile's records
Andy Wingo [Sun, 4 May 2008 15:25:13 +0000 (17:25 +0200)]
Replace ice-9 match's structures with guile's records

* 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.

16 years agoRemoved dot-expander syntax foo
Andy Wingo [Sun, 4 May 2008 14:26:56 +0000 (16:26 +0200)]
Removed dot-expander syntax foo

* module/system/base/syntax.scm (expand-dot!, expand-symbol, syntax):
  Removed, we don't use this syntax any more.

16 years agofinish dedottifying
Andy Wingo [Sun, 4 May 2008 14:25:36 +0000 (16:25 +0200)]
finish dedottifying

* module/system/base/compile.scm: Dedottify.

* module/system/base/language.scm: Export language accessors.

* module/system/repl/common.scm: Dedottify. It's ugly, I know.

16 years agomore dedottification, almost done
Andy Wingo [Sun, 4 May 2008 14:12:36 +0000 (16:12 +0200)]
more dedottification, almost done

* module/system/repl/common.scm:
* module/system/base/compile.scm: Export some more things.

* module/system/repl/command.scm: Dedottify.

16 years agoDedottify some more
Andy Wingo [Sun, 4 May 2008 13:59:40 +0000 (15:59 +0200)]
Dedottify some more

* module/system/il/compile.scm: Dedottify.

* module/system/il/ghil.scm: Export some more thingies.

16 years agoprocedures-with-setters, debitrot `optimize', dedottification
Andy Wingo [Sun, 4 May 2008 13:37:54 +0000 (15:37 +0200)]
procedures-with-setters, debitrot `optimize', dedottification

* 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
  cb4cca12e719edfef1740f238d9187c21c8e1e35. 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.

16 years agofix errors in (language scheme translate) introduced in pmatchification
Andy Wingo [Sun, 4 May 2008 12:28:16 +0000 (14:28 +0200)]
fix errors in (language scheme translate) introduced in pmatchification

* module/language/scheme/translate.scm (trans-pair): Fix some errors
  introduced in pmatchification.

16 years agoStart the process of de-dottification.
Andy Wingo [Sun, 4 May 2008 12:03:53 +0000 (14:03 +0200)]
Start the process of de-dottification.

* module/system/vm/assemble.scm: De-dottify.

16 years agoDefine named accessors for legacy record types
Andy Wingo [Sun, 4 May 2008 11:54:41 +0000 (13:54 +0200)]
Define named accessors for legacy record types

* module/system/base/syntax.scm (define-record): Define named accessors,
  to prepare the code for srfi-9 records switchover.

* module/system/il/ghil.scm:
* module/system/il/glil.scm: Export a bunch of named accessors.

16 years agoRefactor (language scheme translate) to use pmatch
Andy Wingo [Sun, 4 May 2008 11:26:00 +0000 (13:26 +0200)]
Refactor (language scheme translate) to use pmatch

* module/language/scheme/translate.scm: Refactor use of `match' to use
  `pmatch'. Relatively straightforward.

* module/system/base/pmatch.scm (ppat): Fix some copy-n-paste bugs: the _
  rule, the quote rule.

16 years agomore pmatchification
Andy Wingo [Sat, 3 May 2008 17:39:41 +0000 (19:39 +0200)]
more pmatchification

* module/system/il/ghil.scm: No need for a match

* module/system/repl/command.scm: Pmatchify

* module/system/vm/disasm.scm: Pmatchify.

16 years agobugfix to make-cenv
Andy Wingo [Sat, 3 May 2008 17:38:10 +0000 (19:38 +0200)]
bugfix to make-cenv

* module/system/base/compile.scm (make-cenv): Fix make-cenv.

16 years agostart using pmatch instead of match
Andy Wingo [Sat, 3 May 2008 17:23:45 +0000 (19:23 +0200)]
start using pmatch instead of match

* module/system/base/Makefile.am: Add pmatch.scm.

* module/system/base/pmatch.scm: New file, taken from Dan Friedman's
  alpha-kanren paper. Implements a less magical match syntax, pmatch.

* module/system/vm/assemble.scm: No more need for (ice-9 match).

* module/system/vm/conv.scm (code-pack, code->object): Change to use
  pmatch.

16 years agos/match-lambda\*/case-lambda/g
Andy Wingo [Sat, 3 May 2008 17:13:51 +0000 (19:13 +0200)]
s/match-lambda\*/case-lambda/g

* module/system/il/macros.scm: Use case-lambda from srfi-16 rather than
  match-lambda*.

16 years agoconvert a couple more modules to record-case
Andy Wingo [Sat, 3 May 2008 16:47:05 +0000 (18:47 +0200)]
convert a couple more modules to record-case

* 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.

16 years agounify variant types and records; also make-foo instead of <foo>
Andy Wingo [Sat, 3 May 2008 16:32:46 +0000 (18:32 +0200)]
unify variant types and records; also make-foo instead of <foo>

* 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.

16 years agoConvert assemble.scm to use record-case.
Andy Wingo [Sat, 3 May 2008 12:52:36 +0000 (14:52 +0200)]
Convert assemble.scm to use record-case.

* module/system/base/syntax.scm (record?): Temporarily export this thing,
  so that code will remain correct when I change to srfi-9 records.

* module/system/vm/assemble.scm: Convert to use record-case.

16 years agofix to (system base syntax)'s syntax
Andy Wingo [Sat, 3 May 2008 12:00:45 +0000 (14:00 +0200)]
fix to (system base syntax)'s syntax

* module/system/base/syntax.scm: Fix define-module

16 years agorebase record-case on `match'
Andy Wingo [Sat, 3 May 2008 11:55:33 +0000 (13:55 +0200)]
rebase record-case on `match'

* module/system/base/syntax.scm (record-case): Rebase on `match', for
  transition purposes.

16 years agopull in srfi-9, implement record-case
Andy Wingo [Sat, 3 May 2008 11:46:56 +0000 (13:46 +0200)]
pull in srfi-9, implement record-case

* module/system/base/syntax.scm: Pull in srfi-9. Define a record-case
  macro that will replace (match foo (($ <type> slot ...) body...)).

16 years agoclean up some syntax imports and exports
Andy Wingo [Fri, 2 May 2008 16:59:04 +0000 (18:59 +0200)]
clean up some syntax imports and exports

* module/system/base/syntax.scm (system): Don't re-export receive or
  and-let*; modules should explicitly import these if they want to. Don't
  export an empty stack-catch definition!

* module/system/repl/command.scm (system): Pull in and-let*.

* module/system/vm/disasm.scm (system): Don't import and-let*.

16 years agoremove module.scm
Andy Wingo [Fri, 2 May 2008 15:51:34 +0000 (17:51 +0200)]
remove module.scm

* module/system/base/module.scm: Removed module.scm, as it was unused
  (see 9419ff9ae91c93983972797e607e135ecd1233bb).

16 years agocleanups in syntax.scm
Andy Wingo [Fri, 2 May 2008 15:35:25 +0000 (17:35 +0200)]
cleanups in syntax.scm

* benchmark/lib.scm (fibo): Make fibo actually a fibonacci sequence.

* module/system/base/syntax.scm (system): Forward-declare all exports.
  (expand-symbol, slot): Rewrite expand-symbol to expand to a
  non-recursive invocation of `slot', so that in the future when we get
  rid of this syntax, the replacement will be more palatable to the eyes.

16 years agoSlowly improving support for macro compilation.
Ludovic Courtes [Sun, 30 Jul 2006 21:01:40 +0000 (21:01 +0000)]
Slowly improving support for macro compilation.

* module/language/scheme/translate.scm (&current-macros): Removed.
  (&current-macro-module): Removed.
  (&compile-time-module): New.
  (eval-at-compile-time): New.
  (translate): Initialize `&compile-time-module'.
  (expand-macro)[use-syntax]: New case.
  [begin let...]: Don't expand these built-in macros.
  [else]: Rewrote the macro detection and invocation logic.  Invoke macro
  transformers in the current compile-time module.
  (trans): Let `expand-macro' raise an exception if needed.
  (trans-pair)[defmacro define-macro]: Evaluate the macro definition in
  the compile-time module.

* testsuite/t-match.scm: Use `use-syntax' instead of `use-modules' for
  `(ice-9 match)' and `(srfi srfi-9)'.

* testsuite/t-records.scm: Likewise.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-15

16 years agoFixed `autogen.sh' and removed `module' from the list of dirs to build.
Ludovic Court`es [Tue, 10 Jan 2006 08:36:43 +0000 (08:36 +0000)]
Fixed `autogen.sh' and removed `module' from the list of dirs to build.

* autogen.sh: Fixed (call `libtoolize').

* Makefile.am (SUBDIRS): Removed `module' which doesn't build right now.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-16

16 years agoImproved macro handling; started documenting the issue.
Ludovic Courtes [Tue, 3 Jan 2006 23:13:30 +0000 (23:13 +0000)]
Improved macro handling; started documenting the issue.

* doc/guile-vm.texi (Compiling Scheme Code): New node.

* module/language/scheme/translate.scm (&current-macro-module): New.
  (translate): Evaluate macros in `&current-macro-module'.
  (trans-pair): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-13

16 years agoFixed the exception handler of `guilec'.
Ludovic Courtes [Mon, 2 Jan 2006 18:05:23 +0000 (18:05 +0000)]
Fixed the exception handler of `guilec'.

* src/guilec.in: Fixed the exception handler.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-12

16 years agoEncode the length of constant lists/vectors on 2 octets instead of 1.
Ludovic Courtes [Mon, 2 Jan 2006 18:04:04 +0000 (18:04 +0000)]
Encode the length of constant lists/vectors on 2 octets instead of 1.

* module/system/vm/assemble.scm (dump-object!): New sub-procedure
  `too-long'.  For `list' and `vector', encode the length on 2 octets
  instead of 1 and report an error if a list/vector is longer than 65535.

* module/system/vm/disasm.scm (original-value): New sub-procedure
  `list-or-vector?'; when true, return the number of elements for that
  list/vector.

* src/vm_system.c (list): Fetch the length as a two-octet integer.
  (vector): Likewise.

* testsuite/t-basic-contructs.scm: New.

* testsuite/Makefile.am (vm_test_files): Added the above file.

* module/system/vm/core.scm (load-compiled): Added a bit of
  documentation.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-11

16 years agoRenamed the library from `libguilevm' to `libguile-vm'.
Ludovic Courtes [Mon, 2 Jan 2006 15:20:33 +0000 (15:20 +0000)]
Renamed the library from `libguilevm' to `libguile-vm'.

* src/Makefile.am (lib_LTLIBRARIES): Renamed to `libguilevm.la' to
  `libguile-vm.la'.

* module/system/vm/core.scm: Dynamic-link "libguile-vm" instead of
  "libguilevm.so".

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-10

16 years agoAdded support for `defmacro' and `define-macro' in the compiler.
Ludovic Courtes [Tue, 20 Dec 2005 23:22:11 +0000 (23:22 +0000)]
Added support for `defmacro' and `define-macro' in the compiler.

* module/language/scheme/translate.scm: Use `(srfi srfi-39)'.
  (&current-macros): New top-level.
  (expand-macro): New.
  (scheme-primitives): Renamed `%scheme-primitives'.
  (%forbidden-primitives): New.
  (trans): Use `expand-macro' instead of `macroexpand'.
  (trans-pair): Handle `define-macro' and `defmacro'.

* module/system/base/compile.scm (call-with-compile-error-catch): Handle
  non-pair LOC.

* testsuite/t-macros2.scm: New test case.

* testsuite/Makefile.am (vm_test_files): Updated.

* testsuite/t-macros.scm: Test `read-options'.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-9

16 years agoFixed an "unbound variable" in `(system vm conv)'.
Ludovic Courtes [Tue, 20 Dec 2005 23:12:10 +0000 (23:12 +0000)]
Fixed an "unbound variable" in `(system vm conv)'.

* module/system/vm/conv.scm: Autoload `(system vm core)' also when
  `opcode->instruction' is hit.  This fixes an "unbound variable" problem.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-8

16 years agoFixed error handling; detect and report macro expansion errors.
Ludovic Courtes [Tue, 13 Dec 2005 21:33:50 +0000 (21:33 +0000)]
Fixed error handling; detect and report macro expansion errors.

* module/language/scheme/translate.scm (trans): Catch exceptions thrown
  by `macroexpand' and throw a syntax error.
  (trans-pair): Catch calls to `procedure->memoizing-macro' and raise a
  syntax error.

* module/system/base/compile.scm (call-with-compile-error-catch): Made a
  macro (a procedure doesn't do the job).
  (compile-file): Uncommented call to `call-with-compile-error-catch'.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-7

16 years agoTried compiling more code; augmented the doc.
Ludovic Courtes [Tue, 1 Nov 2005 23:24:15 +0000 (23:24 +0000)]
Tried compiling more code; augmented the doc.

* module/language/Makefile.am: New.

* module/language/scheme/Makefile.am: New.

* configure.in: Produce these two new Makefiles.

* doc/guile-vm.texi: Documented `compile-file', `compiled-file-name', and
  `compile-in'.

* module/system/base/compile.scm: Cosmetic changes.

* module/system/base/language.scm: Likewise.

* module/system/il/Makefile.am: Tried (and failed) to compile more
  things.

* module/system/vm/Makefile.am: All source files in here can now be
  compiled without harming further compilation.

* module/system/vm/assemble.scm: Select only specific bindings from
  `(system vm core)'.
  (dump-object!): Show a more meaningful error message.

* module/system/vm/conv.scm: Select only specific bindings from `(system
  vm core)'.

* module/system/vm/debug.scm: Likewise.

* module/system/vm/frame.scm: Changed the header.  Use a renamer for
  `(system vm core)'.

* src/guilec.in: Added options, via `getopt-long'.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-6

16 years agoFixed a Scheme translation bug; cleaned compilation with GCC 4.
Ludovic Courtes [Tue, 1 Nov 2005 21:29:04 +0000 (21:29 +0000)]
Fixed a Scheme translation bug; cleaned compilation with GCC 4.

* module/language/scheme/translate.scm (trans-pair): In the `set!' case,
  when a procedure-with-setter is passed, call `trans:pair' with an
  actual pair.  This fixes a long-lasting bug which prevented compilation
  of `set!' statements with procedures-with-setter (this showed up when
  compiling `(system vm assemble)').

* module/system/base/compile.scm: Added `objcode->u8vector' to the
  `#:select' clause.

* module/system/base/syntax.scm: Cosmetic changes.

* module/system/vm/assemble.scm (preprocess): Removed debugging
  statements.

* src/frames.c: Cosmetic changes.

* src/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): New.

* src/objcodes.c: Use `scm_t_uint8' instead of `char' when relevant.

* src/vm.c (vm_heapify_frames_1): Use `SCM_FRAME_SET_DYNAMIC_LINK ()'.

* src/vm_loader.c: Added casts to mute GCC 4 warnings.

* testsuite/run-vm-tests.scm (*scheme*): Renamed to `%scheme'.
  (run-test-from-file): Renamed to `compile/run-test-from-file'.
  (run-vm-tests): Run each test using both the VM and the interpreter;
  compare the results.

* testsuite/t-proc-with-setter.scm: Try out `get/set'.

* doc/Makefile.am (info_TEXINFOS): New.

* doc/guile-vm.texi: Added index entries and indices.

* doc/texinfo.tex: New file.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-5

16 years agoMinor binding name clash tweak.
Ludovic Court`es [Fri, 28 Oct 2005 14:49:25 +0000 (14:49 +0000)]
Minor binding name clash tweak.

* module/system/base/compile.scm: Only import `the-vm' and `vm-load' from
  `(system vm core)'.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-10

16 years agoStarted documenting the compiler.
Ludovic Courtes [Sat, 25 Jun 2005 06:57:20 +0000 (06:57 +0000)]
Started documenting the compiler.

* 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

16 years ago* src/objcodes.c (make_objcode_by_mmap): Fixed the error type when the
Ludovic Courtes [Sat, 25 Jun 2005 03:13:56 +0000 (03:13 +0000)]
* src/objcodes.c (make_objcode_by_mmap):  Fixed the error type when the
  object file is too small.

* doc/guile-vm.texi:  Documented `make-closure'.  Improved the documentation
  of `load-program'.

* testsuite:  New directory.

* configure.in:  Added `testsuite/Makefile' to `AC_OUTPUT'.

* Makefile.am (SUBDIRS):  Added `testsuite'.

* src/vm_engine.h (VM_CHECK_OBJECT):  New option.
  (CHECK_OBJECT):  New macro.

* src/vm_system.c (object-ref):  Use VM_CHECK_OBJECT.

* module/system/vm/assemble.scm (preprocess):  Commented out the debugging
  code.

* benchmark/lib.scm (do-loop):  New procedure.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-2

16 years agoRemoved a few more deprecated function calls; documented closures.
Ludovic Courtes [Fri, 24 Jun 2005 17:25:36 +0000 (17:25 +0000)]
Removed a few more deprecated function calls;  documented closures.

* src/Makefile.am (.c.x):  Fixed the rule.

* src/envs.c:  Use `scm_hash_get_handle ()' instead of
  `scm_sym2ovcell_soft ()' and `scm_hash_create_handle_x ()' instead of
  `scm_intern_symbol ()'.

* src/objcodes.c (bytecode->objcode):  Don't use `SCM_VALIDATE_INUM', use
  `SCM_VALIDATE_NUMBER' instead.
  (make_objcode_by_mmap):  Check whether the file is smaller than the
  magic cookies; check whether the magic cookies are there.

* src/frames.c (frame-local-ref):  Likewise, but use `SCM_MAKE_VALIDATE'.
  (frame-local-set!):  Likewise.

* src/instructions.c (opcode->instruction):  Likewise.

* src/programs.c (program-external-set!):  New function.

* src/guile-disasm.in:  New file.

* src/Makefile.am:  Produce `guile-disasm'.

* doc/guile-vm.texi:  Documented `external-ref', `external-set', `local-ref'
  and `local-set'.

* module/system/vm/disasm.scm (disassemble-bytecode):  Fixed the way
  `load-program' is represented.

git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-1

16 years agoPlaying with the procedure call mechanism.
Ludovic Court`es [Tue, 3 May 2005 15:13:42 +0000 (15:13 +0000)]
Playing with the procedure call mechanism.

* src/objcodes.c (do-pair):  New experiment.
* src/vm_engine.h (ALIGN_AS_NON_IMMEDIATE):  New macro.
  (POP_LIST_ON_STACK):  New experimental macro.
* src/vm_engine.c (call):  In the procedure call case, I tried using the above
  macro.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-8

16 years agoFixed a stack leak. Now observing actual performance.
Ludovic Court`es [Mon, 2 May 2005 16:32:32 +0000 (16:32 +0000)]
Fixed a stack leak.  Now observing actual performance.

* src/*.[ch]:  Replaced `scm_mem2symbol' by `scm_from_locale_symboln' and
  `scm_ulong2num' by `scm_from_ulong'.
* src/vm_system.c (tail-call):  Fixed stack leak (SP lacked decrement by
  one more Scheme object in the tail-recursive case).
* benchmark/measure.scm (measure):  Make sure we are using the compiled
  procedure (i.e. a program object) when measuring.  This yields better
  results than before.  :-)
* doc/guile-vm.texi:  Augmented the instruction set documentation with
  branch instructions, `call' and `tail-call'.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-7

16 years agoImproved the VM's efficiency. The VM is as fast as the interpreter. :-(
Ludovic Court`es [Fri, 29 Apr 2005 14:12:12 +0000 (14:12 +0000)]
Improved the VM's efficiency.  The VM is as fast as the interpreter.  :-(

* benchmark/lib.scm:  New file.
* benchmark/measure.scm:  New file.
* README:  Added useful pointers to various threads.
* doc/guile-vm.texi:  Fixed the description of `load-program' (it now expects
  _immediate_ integers).
* src/*.[ch]:  Use immediate integers whereever possible, as in the original
  code.  For `CONS', use `scm_cell' rather than `scm_cons'.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-6

16 years agoGot the VM up and running! Augmented the documentation.
Ludovic Court`es [Thu, 28 Apr 2005 15:45:59 +0000 (15:45 +0000)]
Got the VM up and running!  Augmented the documentation.

* src/*.[ch]:  Replaced the remaining `SCM_MAKINUM', and changed `SCM_VELTS'
  into `scm_vector_elements ()'.
* src/vm_loader.c (link):  Fixed so that it pushed a variable object on
  the stack.
* src/vm_system.c (variable-ref):  Fixed so that it uses `scm_variable_ref ()'
  and friends.
* module/system/vm/assemble.scm (dump-object!):  Fixed the string case.
* src/vm_engine.h (CONS):  Use `scm_cons' instead of `SCM_NEWCELL'.
* doc/guile-vm.texi:  Added actual instruction definitions, explanations of
  the program invocation mechanism, programs' object tables, etc., in the
  `Instruction Set' chapter.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-5

16 years agoFixed the compiler, got the disassembler working.
Ludovic Court`es [Wed, 27 Apr 2005 09:36:52 +0000 (09:36 +0000)]
Fixed the compiler, got the disassembler working.

* doc/guile-vm.texi:  Texified and cleaned up.
* src/vm.c:  Use `scm_from_locale_string ()' instead of `scm_makfrom0str ()'.
* src/vm_engine.c:  Likewise.
* src/programs.c (scm_program_bytecode):  Return a u8vector instead of a string.
* module/system/vm/conv.scm (make-byte-decoder):  Fixed a few things wrt. to
  the string to u8vector transition.
* src/objcodes.c (bytecode->objcode):  Fixed a bug where the last 10 bytes of
  the bytecode where ignored.
* module/system/vm/assemble.scm (dump-object!):  Don't convert everything
  to a u8vector, keep strings where it makes sense.
* module/system/vm/conv.scm (code->bytes):  Accordingly, convert strings to
  u8vectors when needed.
  (make-byte-decoder):  Accordingly too, when decoding instructions, return
  variable-length instructions' argument as strings except for `load-program'.
* module/system/vm/disasm.scm:  Export `disassemble-bytecode'.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-4

16 years agoUpdated the assembly process so that `u8vectors' are used. Compilation works.
Ludovic Court`es [Mon, 25 Apr 2005 16:56:18 +0000 (16:56 +0000)]
Updated the assembly process so that `u8vectors' are used.  Compilation works.

* module/system/vm/conv.scm (encode-length):  Use u8vectors.
  (code->bytes):  Likewise.
* module/system/vm/assemble.scm (codegen):  Use u8vectors instead
  of strings.
* src/objcodes.c (objcode->string):  Removed.
  (objcode->u8vector):  New function.
* module/system/base/compile.scm (compile-file):  Use `objcode->u8vector'
  and `uniform-vector-write'.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-3

16 years agoTranslation from Scheme to GHIL, and compilation to GLIL work.
Ludovic Court`es [Fri, 22 Apr 2005 16:00:33 +0000 (16:00 +0000)]
Translation from Scheme to GHIL, and compilation to GLIL work.

* src/*.c:  Removed calls to `scm_must_malloc', `SCM_MUST_MALLOC' and
  `scm_must_free'.  Same for `SCM_INUMP', `SCM_INUM', `SCM_STRING_CHARS',
  and the likes.
* module/system/base/syntax.scm:  Do not import `(ice-9 match)' and do
  not re-export `match', do not export `syntax-error' which was not
  defined here.
* module/system/base/compile.scm (call-with-compile-error-catch):  Use
  the `catch' form instead of `try'.
* src/instructions.c:  Use `scm_from_char ()' instead of the deprecated
  macro `SCM_MAKINUM ()'.
* src/instructions.h (scm_instruction):  Made `npop' a signed char.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-2

16 years agoUpdated the C code base so that it compiles with Guile 1.7.2.
Ludovic Court`es [Fri, 22 Apr 2005 11:07:06 +0000 (11:07 +0000)]
Updated the C code base so that it compiles with Guile 1.7.2.

* src/*.[ch]:  Introduced changes so that it compiles with Guile 1.7.2.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-1

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 2 May 2001 15:05:05 +0000 (15:05 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 25 Apr 2001 07:42:32 +0000 (07:42 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 25 Apr 2001 01:55:45 +0000 (01:55 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Mon, 23 Apr 2001 06:17:52 +0000 (06:17 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Mon, 23 Apr 2001 04:28:13 +0000 (04:28 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Sun, 22 Apr 2001 11:16:37 +0000 (11:16 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Sun, 22 Apr 2001 02:13:48 +0000 (02:13 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Fri, 20 Apr 2001 18:35:59 +0000 (18:35 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Fri, 20 Apr 2001 18:35:59 +0000 (18:35 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Thu, 19 Apr 2001 06:28:03 +0000 (06:28 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Thu, 19 Apr 2001 05:59:09 +0000 (05:59 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Thu, 19 Apr 2001 03:09:27 +0000 (03:09 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Mon, 16 Apr 2001 03:43:48 +0000 (03:43 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Mon, 16 Apr 2001 00:08:10 +0000 (00:08 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Sun, 15 Apr 2001 15:02:41 +0000 (15:02 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Sun, 15 Apr 2001 14:54:59 +0000 (14:54 +0000)]
*** empty log message ***

23 years agoSLIB init file for Guile.
Keisuke Nishida [Sat, 14 Apr 2001 11:26:26 +0000 (11:26 +0000)]
SLIB init file for Guile.

23 years agoImport SLIB 2d1.
Keisuke Nishida [Sat, 14 Apr 2001 11:24:45 +0000 (11:24 +0000)]
Import SLIB 2d1.

23 years ago*** empty log message ***
Keisuke Nishida [Thu, 12 Apr 2001 23:30:38 +0000 (23:30 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Thu, 12 Apr 2001 00:15:31 +0000 (00:15 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 11 Apr 2001 23:43:01 +0000 (23:43 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 11 Apr 2001 23:27:08 +0000 (23:27 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 11 Apr 2001 23:12:37 +0000 (23:12 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 11 Apr 2001 21:54:57 +0000 (21:54 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Wed, 11 Apr 2001 20:57:44 +0000 (20:57 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Tue, 10 Apr 2001 06:11:26 +0000 (06:11 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Tue, 10 Apr 2001 00:32:46 +0000 (00:32 +0000)]
*** empty log message ***

23 years ago*** empty log message ***
Keisuke Nishida [Mon, 9 Apr 2001 06:44:26 +0000 (06:44 +0000)]
*** empty log message ***