summaryrefslogtreecommitdiff
path: root/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2010-05-26Rename the `testsuite' directory to `test-suite/vm'.Ludovic Courtès23-478/+0
* testsuite: Move to... * test-suite/vm: ... here. * Makefile.am (SUBDIRS): Remove `testsuite'. * configure.ac: Output `test-suite/vm/Makefile' instead of `testsuite/Makefile'. * test-suite/Makefile.am (SUBDIRS): Add `vm'.
2010-02-01Inline SRFI-9 constructors too.Ludovic Courtès1-2/+1
* module/srfi/srfi-9.scm (define-record-type)[constructor]: Use `define-inlinable' instead of `define'. * test-suite/lib.scm (exception:syntax-pattern-unmatched): New variable. * test-suite/tests/srfi-9.test ("constructor")["foo 0 args (inline)", "foo 2 args (inline)"]: New tests. ["foo 0 args", "foo 2 args"]: Adjust to constructor inlining. * testsuite/t-records.scm: Remove wrong-arg-count case.
2009-08-20use primitive-eval in run-vm-tests.scmAndy Wingo1-2/+1
* testsuite/run-vm-tests.scm (run-vm-tests): Use primitive-eval, as we'll be changing eval soon.
2009-07-15Make the non-integrated VM test-suite less verbose.Ludovic Courtès1-5/+2
* testsuite/run-vm-tests.scm (run-vm-tests): Don't display the number of tests passed since it's always 1 or 0.
2009-06-17Complete changing license to LGPLv3+Neil Jerram1-6/+6
(Still guile-readline to do, but that will all be GPLv3+.)
2009-05-20Fix a bug in the (ice-9 match) testAndy Wingo1-1/+1
* testsuite/t-match.scm (matches?): Fix match invocation. As far as I can tell, although (ice-9 match) does advertise a => form of clauses, it requires that the end of the => be a symbol. For some reason this works in the interpreter: ((lambda () (begin => #t))) It's part of the expansion of matches?. It also worked in the old compiler. Thinking that maybe toplevel references could cause side effects, I made the new compiler actually ref =>, which brought this to light.
2009-03-27allow building against uninstalled guile; move some things to meta/Andy Wingo1-1/+1
* README: Add more info about building against an uninstalled Guile. * meta/: New directory. The proximate cause of its creation is that I want to be able to build external packages against uninstalled Guile, and to do that I need guile-tools in the PATH, but I don't want $top_builddir/libtool in the path. But it seems like a good reorganization, for things that are /about/ Guile: pkg-config files, m4 files, guile-config... then we also include uninstalled info: the environment, the pre-inst-guile script, etc. * meta/guile-1.8-uninstalled.pc.in: New pkg-config template. pkg-config prefers -uninstalled pkg-config files, if they are in its path. * meta/Makefile.am: * meta/ChangeLog-2008: * meta/gdb-uninstalled-guile.in: * meta/guile-1.8.pc.in: * meta/guile-config.in: * meta/guile.m4: * meta/guile-tools.in: Moved to meta/. * meta/guile.in: This is the new name of pre-inst-guile.in. * meta/uninstalled-env.in: And this, pre-inst-guile-env.in. * Makefile.am: * am/guilec: * am/pre-inst-guile: * check-guile.in: * configure.in: * doc/ref/Makefile.am: * gc-benchmarks/run-benchmark.scm: * test-suite/standalone/Makefile.am: * test-suite/standalone/README: * testsuite/Makefile.am: Adapt to meta/ change.
2009-03-25Fix `testsuite/Makefile.am' for `distcheck'.Ludovic Courtès1-4/+2
* testsuite/Makefile.am (check_SCRIPTS): Remove, renamed to `TESTS'. (EXTRA_DIST): Add $(TESTS).
2009-03-17tweaks to the un-integrated test casesAndy Wingo1-12/+6
* testsuite/Makefile.am: Sortof turn these VM tests into more automake-like tests. Needs further work.
2009-02-18Add `load-unsigned-integer' instruction.Ludovic Courtès2-0/+6
* libguile/vm-i-loader.c (load_unsigned_integer): New loader. * module/language/assembly.scm (byte-length): Handle `load-unsigned-integer'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. * module/language/glil/compile-assembly.scm (dump-object): Emit a `load-unsigned-integer' instruction for positive integers. This fixes loading of integers greater than 2^31 - 1. * testsuite/Makefile.am (vm_test_files): Add `t-literal-integers.scm'. * doc/ref/vm.texi (Loading Instructions): Add `load-unsigned-integer'.
2009-01-30remove conv.scm, disasm.scm; objcode->bytecode renameAndy Wingo1-1/+0
* module/system/vm/Makefile.am: * module/system/vm/conv.scm: * module/system/vm/disasm.scm: Remove these modules, as their functionality is now in (language ...). * libguile/objcodes.h: * libguile/objcodes.c: * module/system/vm/objcode.scm: Rename objcode->u8vector to objcode->bytecode. * module/system/vm/frame.scm: * module/language/bytecode/spec.scm: Fix for objcode->bytecode. * scripts/disassemble: * testsuite/run-vm-tests.scm: Fix for (system vm disasm) removal. * module/system/repl/command.scm: Use the right disassembler.
2008-11-14nifty generic compiler infrastructure -- no more hardcoded passesAndy Wingo1-4/+3
* module/system/base/language.scm (<language>): Rework so that instead of hardcoding passes in the language, we define compilers that translate from one language to another. Add `parser' to the language fields, a bit of a hack but useful for languages with s-expression external representations but with record internal representations. (define-language, *compilation-cache*, invalidate-compilation-cache!) (compute-compilation-order, lookup-compilation-order): Add an algorithm that does a depth-first search for a translation path from a source language to a target language, caching the result in a lookup table. * module/language/scheme/spec.scm: * module/language/ghil/spec.scm: Update to the new language format. * module/language/glil/spec.scm: Add a language specification for GLIL, with a compiler to objcode. Also there are parsers and printers, for repl usage, but for some reason this doesn't work yet. * module/language/objcode/spec.scm: Define a language specification for object code. There is some sleight of hand here, in the "compiler" to values; but there is method behind the madness, because this way we higher levels can pass environments (a module + externals pair) to objcode->program. * module/language/value/spec.scm: Define a language specification for values. There is something intellectually dishonest about this, but it does serve its purpose as a foundation for the language hierarchy. * configure.in: * module/language/Makefile.am * module/language/ghil/Makefile.am * module/language/glil/Makefile.am * module/language/objcode/Makefile.am * module/language/value/Makefile.am: Autotomfoolery for the ghil, glil, objcode, and value languages. * module/language/scheme/translate.scm (translate): Import the bits that understand `compile-time-environment' here, and pass on the relevant portions of the environment to the next compiler pass. * module/system/base/compile.scm (current-language): New procedure, refs the current language fluid, or lazily sets it to scheme. (call-once, call-with-output-file/atomic): Refactor these bits to use with-throw-handler. No functional change. (compile-file, compile-and-load, compile-passes, compile-fold) (compile): Refactor the public interface of the compiler to be generic and simple. Uses `lookup-compilation-order' to find a path from the source language to the target language. * module/system/base/syntax.scm (define-type): Adapt to changes in define-record. (define-record): Instead of expecting all slots in the first form, expect them in the body, and let the first form hold the options. * module/system/il/compile.scm (compile): Adapt to the compilation pass API (three in and two out). * module/system/il/ghil.scm (<ghil-var>, <ghil-env>) (<ghil-toplevel-env>): Adapt to define-record changes. * module/system/il/glil.scm (<glil-vars>): Adapt to define-record changes. (<glil>, print-glil): Add a GLIL record printer that uses unparse. (parse-glil, unparse-glil): Update unparse (formerly known as pprint), and write a parse function. * module/system/repl/common.scm (<repl>): Adapt to define-record changes. (repl-parse): New function, parses the read form using the current language. Something of a hack. (repl-compile): Adapt to changes in `compile'. (repl-eval): Fix up the does-the-language-have-a-compiler check for changes in <language>. * module/system/repl/repl.scm (start-repl): Parse the form before eval. * module/system/repl/command.scm (describe): Parse. (compile): Be more generic. (compile-file): Adapt to changes in compile-file. (disassemble, time, profile, trace): Parse. * module/system/vm/debug.scm: * module/system/vm/assemble.scm: Adapt to define-record changes. * module/language/scheme/translate.scm (receive): Fix an important bug that gave `receive' letrec semantics instead of let semantics. Whoops!
2008-11-01fix for (apply values '(1))Andy Wingo1-0/+4
* libguile/vm-i-system.c (return/values): In the multiple-values-to-a-single-value-continuation (or MV but where N=1), null out the correct number of values from the stack. Fixes aborts on (apply values '(1)). * testsuite/t-values.scm (call-with-values): Add a test.
2008-11-01fix multiple values coming from interpreted or C proceduresAndy Wingo1-7/+8
* libguile/vm-i-system.c (call, goto/args): Handle the case in which a non-program (i.e. interpreted program or a subr) returns multiple values. * testsuite/t-values.scm: Add test case that exhibited this problem.
2008-10-18fix bug in self-tail-recursion with "external" variables; other sundriesAndy Wingo2-0/+23
* gdbinit (pp, inst): New commands. * libguile/vm-engine.c (vm_error_not_a_pair): New error case. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS): New macro -- use this instead of SCM_VALIDATE_* because SCM_VALIDATE will exit nonlocally before we have a chance to sync the regs. (car, cdr, set-car, set-cdr): Use VM_VALIDATE_CONS. * libguile/vm-i-system.c (goto/args): Bugfix: when doing a self-tail-recursion, allocate fresh externals. Fixes use of match.go. * module/system/vm/assemble.scm (dump-object!): Add some checks that we aren't dumping out values that the VM can't handle. * module/system/vm/disasm.scm (disassemble-externals): Fix rotten call to `print-info'. * oop/goops/dispatch.scm: Add a FIXME. * testsuite/Makefile.am (vm_test_files): * testsuite/t-closure4.scm (extract-symbols): New test, distilled with much effort out of match.scm. * ice-9/Makefile.am (NOCOMP_SOURCES): Re-enable compilation of match.scm. Yay!
2008-09-30fix compilation of quasiquote with splicing and improper listsAndy Wingo1-1/+4
* libguile/vm-engine.h (POP_CONS_MARK): New macro, analagous to POP_LIST_MARK; used in quasiquote on improper lists. * libguile/vm-i-system.c (cons-mark): New instruction. You know the drill, remove all your .go files please. * module/system/il/compile.scm (codegen): Compile quasiquoted improper lists with splices correctly. Additionally check that we don't have slices in the CDR of an improper list. * testsuite/t-quasiquote.scm: Add a test for unquote-splicing in improper lists.
2008-09-28allocate variables that are set! on the heapAndy Wingo2-0/+17
* module/system/il/ghil.scm (ghil-lookup): So, it turns out this function needed to be split into three: (ghil-var-is-bound?, ghil-var-for-ref!, ghil-var-for-set!): The different facets of ghil-lookup. Amply commented in the source. The difference being that we now allocate variables that are set! on the heap, so that other continuations see their possibly-modified values. (force-heap-allocation!): New helper. * testsuite/Makefile.am: * testsuite/t-call-cc.scm: New test, that variables that are set! are allocated on the heap, so that subsequent modifications are still seen by the continuation. The test was distilled from test 7.3 in r5rs_pitfall.test.
2008-09-13fix *another* bug in compiling `or'. incredible.Andy Wingo1-0/+2
* 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'.
2008-09-02fix nested quasiquotes (yeepers)Andy Wingo2-0/+10
* module/language/scheme/translate.scm (primitive-syntax-table) (trans-quasiquote): Fix handling of nested quasiquotes. * testsuite/Makefile.am (vm_test_files): * testsuite/t-quasiquote.scm: Add a quasiquote test case.
2008-08-21merge guile-vm into libguile itselfAndy Wingo1-1/+1
* 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?
2008-08-11fix bug in compilation of `and' and `or'; more robust underflow detection.Andy Wingo4-0/+50
* 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.
2008-08-07build fixesAndy Wingo2-2/+3
* 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.
2008-05-20fix distcheckAndy Wingo1-1/+1
* src/Makefile.am (AM_CFLAGS, libguile_vm_la_LDFLAGS): Don't build with -pg. (There are better profilers out there.) (CLEANFILES): Add guilev and guile-disasm. * testsuite/Makefile.am (GUILE_VM): s/srcdir/builddir/.
2008-05-19bind all module-level variables lazilyAndy Wingo1-3/+3
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.
2008-05-19Add instructions for doing very late bindingAndy Wingo3-4/+13
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.
2008-05-14fix use-syntax / use-modules confusion -- fixes testsuitesAndy Wingo2-14/+3
* 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.
2008-04-25Slowly improving support for macro compilation.Ludovic Courtes2-3/+20
* 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
2008-04-25Encode the length of constant lists/vectors on 2 octets instead of 1.Ludovic Courtes2-0/+17
* 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
2008-04-25Added support for `defmacro' and `define-macro' in the compiler.Ludovic Courtes3-1/+20
* 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
2008-04-25Fixed a Scheme translation bug; cleaned compilation with GCC 4.Ludovic Courtes6-12/+49
* 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
2008-04-25* src/objcodes.c (make_objcode_by_mmap): Fixed the error type when theLudovic Courtes13-0/+288
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