summaryrefslogtreecommitdiff
path: root/test-suite
Commit message (Collapse)AuthorAgeFilesLines
* Allow redefinitions in compiled code as in `(define round round)'.Ludovic Courtès2009-08-131-0/+10
| | | | | | | | | * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (chi-top)[define-form]: If a same-named imported variable exists, take its value instead of `#f'. * test-suite/tests/compiler.test ("psyntax")["redefinition"]: New tests.
* "fix" <let>-bound lambda expressions tooAndy Wingo2009-08-121-9/+16
| | | | | | | | | | | | | | | | | * module/language/tree-il/compile-glil.scm (compile-glil): Compute warnings before optimizing, as unreferenced variables will be optimized out. * libguile/_scm.h: Fix C99 comment. * module/language/tree-il/fix-letrec.scm (partition-vars): Also analyze let-bound vars. (fix-letrec!): Fix a bug whereby a set! to an unreffed var would be called for value, not effect. Also "fix" <let>-bound lambda expressions -- really speeds up pmatch. * test-suite/tests/tree-il.test ("lexical sets", "the or hack"): Update to take into account the new optimizations.
* Regression, scm_string fails to test for circular listsMichael Gran2009-08-121-1/+11
| | | | | | | * libguile/string.c (scm_string): Restores the functionality where scm_string tests for circular lists * test-suite/tests/strings.test: add test for circular lists
* rework the vm support for wide stringsAndy Wingo2009-08-121-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-engine.c (vm_error_bad_wide_string_length): New error case. * libguile/vm-i-loader.c (load-unsigned-integer, load-integer) (load-keyword): Remove these instructions. The former two are obsoleted by make-int64/make-uint64, the latter via make-keyword. (load-string): Only handle narrow strings. (load-symbol): Only handle narrow symbols. The wide case is handled via make-symbol. (load-wide-string): New instruction, for wide strings. * libguile/vm-i-system.c (define): Move here from loaders.c, as now it just takes a sym on the stack. (make-keyword, make-symbol): New instructions. * module/language/assembly.scm: Remove removed instructions. No more width byte in load-string etc. * module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt to change in instruction set. * module/language/glil/compile-assembly.scm (glil->assembly): Compile define by pushing the sym then emitting (define). (dump-object): Dump narrow and wide strings differently. Use make-keyword and make-symbol as appropriate. * module/language/tree-il/compile-glil.scm (flatten): When compiling a ref to a primitive (not a call), first see if the primitive is actually bound in the root module. (That's not the case with e.g. bytevector-u8-ref). * module/system/xref.scm (program-callee-rev-vars): Don't parse out "nexts". * test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode format change.
* More string and symbol testsMichael Gran2009-08-102-7/+317
| | | | | | * test-suite/tests/strings.test: more tests * test-suite/tests/symbols.test: more tests
* Merge commit 'origin/master'Michael Gran2009-08-081-1/+1
|\
| * add1 and sub1 instructionsAndy Wingo2009-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/vm-i-scheme.c: Add add1 and sub1 instructions. * module/language/tree-il/compile-glil.scm: Compile 1+ and 1- to add1 and sub1. * module/language/tree-il/primitives.scm (define-primitive-expander): Add support for `if' statements in the consequent. (+, -): Compile (- x 1), (+ x 1), and (+ 1 x) to 1- or 1+ as appropriate. (1-): Remove this one. Seems we forgot 1+ before, but we weren't compiling it nicely anyway. * test-suite/tests/tree-il.test ("void"): Fix expected compilation of (+ (void) 1) to allow for add1.
* | Add Unicode strings and symbolsMichael Gran2009-08-081-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds full Unicode strings as a datatype, and it adds some minimal functionality. The terminal and port encoding is assumed to be ISO-8859-1. Non-ISO-8859-1 characters are written or input as string character escapes. The string character escapes now have 3 forms: \xXX \uXXXX and \UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits. The process for writing to strings has been modified. There is now a function scm_i_string_start_writing that does the copy-on-write conversion if necessary. To compile strings that may be wide, the VM storage of strings and string-likes has changed. Most string-using functions have not yet been updated and may break when used with wide strings. * module/language/assembly/compile-bytecode.scm (write-bytecode): use variable width string bytecode format * module/language/assembly.scm (byte-length): use variable width bytecode format * libguile/vm-i-loader.c (load-string, load-symbol): (load-keyword, define): use variable-width bytecode format * libguile/vm-engine.h (FETCH_WIDTH): new macro * libguile/strings.h: new declarations * libguile/strings.c (make_wide_stringbuf): new function (widen_stringbuf): new function (scm_i_make_wide_string): new function (scm_i_is_narrow_string): new function (scm_i_string_wide_chars): new function (scm_i_string_start_writing): new function (scm_i_string_ref): new function (scm_i_string_set_x): new function (scm_i_is_narrow_symbol): new function (scm_i_symbol_wide_chars, scm_i_symbol_ref): new function (scm_string_width): new function (unistring_escapes_to_guile_escapes): new function (scm_to_stringn): new function (scm_i_stringbuf_free): modify for wide strings (scm_i_substring_copy): modify for wide strings (scm_i_string_chars, scm_string_append): modify for wide strings (scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings (scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf): (scm_string, scm_i_deprecated_string_chars): modify for wide strings (scm_from_locale_string, scm_from_locale_stringn): add null test * libguile/srfi-13.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing (scm_string_for_each): modify for wide strings * libguile/socket.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/rw.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/read.c (scm_read_string): allow reading of wide strings * libguile/print.h: add declaration for scm_charprint * libguile/print.c (iprin1): print wide strings and add new string escapes (scm_charprint): new function * libguile/ports.h: new declarations for scm_lfwrite_substr and scm_lfwrite_str * libguile/ports.c (update_port_lf): new function (scm_lfwrite): use update_port_lf (scm_lfwrite_substr): new function (scm_lfwrite_str): new function * test-suite/tests/asm-to-bytecode.test ("compiler"): add string width byte to sting-like asm tests
* Add unused variable analysis in the tree-il->glil compiler.Ludovic Courtès2009-07-311-1/+77
| | | | | | | | | | | | | * module/language/tree-il/analyze.scm (<binding-info>): New record type. (report-unused-variables): New procedure. * module/language/tree-il/compile-glil.scm (%warning-passes): New variable. (compile-glil): Honor `#:warnings' from OPTS. * test-suite/tests/tree-il.test (call-with-warnings): New procedure. (%opts-w-unused): New variable. ("warnings"): New test prefix.
* Add `tree-il-fold', a purely functional iterator on `tree-il'.Ludovic Courtès2009-07-311-0/+39
| | | | | | * module/language/tree-il.scm (tree-il-fold): New procedure. * test-suite/tests/tree-il.test ("tree-il-fold"): New test prefix.
* make sure all programs are 8-byte alignedAndy Wingo2009-07-261-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/objcodes.c (OBJCODE_COOKIE): Bump objcode cookie, as we added to struct scm_objcode. * libguile/objcodes.h (struct scm_objcode): Add a uint32 after metalen and before base, so that if the structure has 8-byte alignment, base will have 8-byte alignment too. (Before, base was 12 bytes from the start of the structure, now it's 16 bytes.) * libguile/vm-engine.h (ASSERT_ALIGNED_PROCEDURE): Add a check that can be turned on with VM_ENABLE_PARANOID_ASSERTIONS. (CACHE_PROGRAM): Call ASSERT_ALIGNED_PROCEDURE. * libguile/vm-i-system.c (long-local-ref): Add a missing semicolon. * libguile/vm.c (really_make_boot_program): Rework to operate directly on a malloc'd buffer, so that the program will be 8-byte aligned. * module/language/assembly.scm (*program-header-len*): Add another 4 for the padding. (object->assembly): Fix case in which we would return (make-int8 0) instead of (make-int8:0). This would throw off compile-assembly.scm's use of addr+. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out the padding int. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And pop off the padding int too. * module/language/glil/compile-assembly.scm (glil->assembly): Don't pack the assembly, assume that assembly.scm has done it for us. If a program has a meta, pad out the program so that meta will be aligned. * test-suite/tests/asm-to-bytecode.test: Adapt to expect programs to have the extra 4-byte padding int.
* nlocs is now 16 bits wideAndy Wingo2009-07-241-35/+38
| | | | | | | | | | | | | | | | * libguile/objcodes.h (struct scm_objcode): Remove the "unused" field -- the old "nexts" -- and expand nlocs to 16 bits. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write the nlocs as a uint16. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decompile 16-bit nlocs. It seems this decompilation is little-endian :-/ * test-suite/tests/asm-to-bytecode.test: Fix up to understand nlocs as a little-endian value. The test does the right thing regarding endianness.
* remove all mentions of "external" from the compiler and related codeAndy Wingo2009-07-232-73/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | With this, GHIL is effectively bitrotten. I need to port the ECMAScript compiler to tree-il, then I'll remove it. * module/language/assembly.scm (byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): (disassemble-free-vars, code-annotation): * module/language/glil.scm (<glil-program>, <glil-local>) (<glil-exteral>, parse-glil, unparse-glil): * module/language/glil/compile-assembly.scm (make-meta): (compile-assembly, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): * module/language/objcode/spec.scm (decompile-value): * module/language/tree-il/compile-glil.scm (flatten-lambda): * module/system/vm/frame.scm (frame-binding-ref): (frame-binding-set!): * module/system/vm/program.scm (binding:boxed?): * module/system/vm/trace.scm (trace-next): * test-suite/tests/asm-to-bytecode.test ("compiler"): * test-suite/tests/tree-il.test: Remove all mentions of "external", and of <glil-local>. Docs updates will come soon.
* rename "closure-ref" to "free-ref"; s/vars/variables/ in some namesAndy Wingo2009-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/programs.h: * libguile/programs.c: (SCM_PROGRAM_FREE_VARIABLES): Rename from SCM_PROGRAM_FREE_VARS. Callers changed. * libguile/programs.c (scm_make_program): Rename arg to "free_variables". (scm_program_free_variables): Rename from program-free-vars. * libguile/vm-engine.h: * libguile/vm-engine.c (VM_CHECK_FREE_VARIABLES): Rename from VM_CHECK_CLOSURE. (vm_engine, CACHE_PROGRAM): Rename closure and closure_count to free_vars and free_vars_vount. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Rename from CLOSURE_REF. (free-ref, free-boxed-ref, free-boxed-set): Rename from closure-ref, closure-boxed-ref, closure-boxed-set. (make-closure): Renamed from make-closure2. * module/language/glil/compile-assembly.scm (glil->assembly): Hack to never write out the the old "make-closure" instruction. Will fix better later. Change to emit free-ref etc instead of closure-ref. * module/language/tree-il/compile-glil.scm (flatten): Emit make-closure instead of make-closure2, now that the old make-closure is gone. * module/system/vm/program.scm (system): Rename program-free-vars to program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update for make-closure.
* compile lexical variable access and closure creation to the new opsAndy Wingo2009-07-231-37/+39
| | | | | | | | | | | | | | | | | | | | | | * module/language/glil.scm (<glil>): New GLIL type, <glil-lexical>, which will subsume other lexical types. * module/language/glil/compile-assembly.scm: Compile <glil-lexical>. (make-open-binding): Change the interpretation of the second argument -- instead of indicating an "external" var, it now indicates a boxed var. (open-binding): Adapt to new glil-bind format. * module/language/tree-il/analyze.scm: Add a lot more docs. (analyze-lexicals): Change the allocation algorithm and output format to allow the tree-il->glil compiler to capture free variables appropriately and to reference bound variables in boxes if necessary. Amply documented. * module/language/tree-il/compile-glil.scm (compile-glil): Compile lexical variable access to <glil-lexical>. Emit variable capture and closure creation code here, instead of leaving that task to the GLIL->assembly compiler. * test-suite/tests/tree-il.test: Update expected code emission.
* Fix tests that assumed little endian.Ludovic Courtès2009-07-141-12/+29
| | | | | | | * test-suite/tests/asm-to-bytecode.test (u32->u8-list): New procedure. ("compiler")[(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)), (load-program 3 2 1 0 () 3 (load-program 3 2 1 0 ...))]: Make these tests work on hosts whose endianness is not little endian.
* Enclose `bit-operations.test' in its own module.Ludovic Courtès2009-07-051-3/+4
| | | | * test-suite/tests/bit-operations.test: Use the `define-module' clause.
* Read complex numbers where both parts are inexact decimalsNeil Jerram2009-07-011-1/+8
| | | | | | | | | | | | Thanks to Bill Schottstaedt for reporting this problem! * libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness being INEXACT on entry (as is possible when reading a complex number): use local exactness variable x which starts as EXACT. Call mem2decimal_from_point () with &x instead of p_exactness. * test-suite/tests/numbers.test ("string->number"): Add complex number tests suggested by Bill.
* run bytevectors tests under the compiler and evaluatorAndy Wingo2009-06-261-7/+27
| | | | | * test-suite/tests/bytevectors.test: Run a number of tests under the compiler/vm and the evaluator.
* Make bytevectors accessible using the generalized-vector API.Ludovic Courtès2009-06-221-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a side effect, this allows compilation of literal bytevectors ("#vu8(...)"), which gets done by the generic array handling of the GLIL->assembly compiler. * doc/ref/api-compound.texi (Generalized Vectors): Mention bytevectors. (Arrays, Array Syntax): Likewise. * doc/ref/api-data.texi (Bytevectors as Generalized Vectors): New node. * libguile/bytevectors.c (scm_i_bytevector_generalized_set_x): New. * libguile/bytevectors.h (scm_i_bytevector_generalized_set_x): New declaration. * libguile/srfi-4.c (scm_i_generalized_vector_type, scm_array_handle_uniform_element_size, scm_array_handle_uniform_writable_elements): Add support for bytevectors. * libguile/unif.c (type_creator_table): Add `vu8'. (bytevector_ref, bytevector_set): New functions. (memoize_ref, memoize_set): Add support for bytevectors. * libguile/vectors.c (scm_is_generalized_vector, scm_c_generalized_vector_length, scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): Add support for bytevectors. * test-suite/tests/bytevectors.test ("Generalized Vectors"): New test set.
* Deterministic test for the r6rs-ports.test segmentation faultNeil Jerram2009-06-211-0/+1
| | | | | * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Add (gc), to test the (ex-)bug in cbp_mark () when marking a closed port.
* Implement R6RS bytevector read syntax.Ludovic Courtès2009-06-192-1/+58
| | | | | | | | | * libguile/read.c (scm_read_bytevector): New function. (scm_read_sharp): Add `v' case for bytevectors. * test-suite/lib.scm (exception:read-error): New variable. * test-suite/tests/bytevectors.test ("Datum Syntax"): New test set.
* Fix `equal?' on bytevectors.Ludovic Courtès2009-06-191-1/+6
| | | | | | | * libguile/bytevectors.c (bytevector_equal_p): New function. * test-suite/tests/bytevectors.test ("2.3 Operations on Bytes and Octets")["equal?"]: New test.
* Reinstate lines removed by mistake from chars.testNeil Jerram2009-06-171-0/+6
|
* Change Guile license to LGPLv3+Neil Jerram2009-06-17103-781/+738
| | | | | | | | | | (Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
* fix bug in goops' method cache with rest argsAndy Wingo2009-06-071-0/+13
| | | | | | | * module/oop/goops/compile.scm (code-table-lookup): Fix a tricky little bug! * test-suite/tests/goops.test ("the method cache"): Add a wee test.
* Fix popen.test on NetBSD and Ubuntu Jaunty, where sh is not BashNeil Jerram2009-06-061-1/+1
| | | | | | | | | Thanks to Greg Troxel for reporting, and Barry Fishman for the explanation and fix. * test-suite/tests/popen.test ("open-input-pipe"): Use shell function `read' with an explicit argument, as apparently not all shells support read with no argument.
* fix error autocompiling parts of the compiler; make check worksAndy Wingo2009-06-031-0/+4
| | | | | | | | | | * libguile/load.c (scm_try_autocompile): Punt if compiled-file-name does not resolve, which would indicate that the file in question is part of the compiler itself. * test-suite/tests/elisp.test: Today I was an evil one -- disable autocompilation for the elisp tests, as they are meant only for the memoizer's eyes. Hopefully Daniel will fix this :-)
* Merge branch 'master' of git://git.savannah.gnu.org/guileJulian Graham2009-06-0213-292/+1808
|\
| * Merge branch 'syncase-in-boot-9'Andy Wingo2009-05-2910-290/+755
| |\ | | | | | | | | | | | | Conflicts: module/Makefile.am
| | * add tests for #' etcsyncase-in-boot-9Andy Wingo2009-05-281-0/+12
| | | | | | | | | | | | | | | * test-suite/tests/reader.test ("#'"): Add tests for the hash-syntax reader macros.
| | * add reader tests for #;Andy Wingo2009-05-281-0/+23
| | | | | | | | | | | | * test-suite/tests/reader.test ("#;"): Add reader tests for #;.
| | * fix tree-il test to work if source info happens to be presentAndy Wingo2009-05-221-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il/compile-glil.scm (flatten-lambda): Fix source emission. * test-suite/tests/tree-il.test (strip-source): Strip source info on tree-il before compiling, so we don't get extraneous source info in the glil. Make check passes!
| | * syntax.test is passing, yayAndy Wingo2009-05-221-84/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test-suite/tests/syntax.test ("top-level define"): Remove the test for currying, as we don't do that any more by default. It should be easy for the user to add in if she wants it, though. ("do"): Remove unmemoization tests, as sc-expand fully expands `do'. ("while"): Remove while tests in empty environments. They have been throwing 'unresolved, and the problem they seek to test is fully handled by hygiene anyway. And otherwise tweak expected exception strings, and everything passes!
| | * residualize names into procedures. re-implement srfi-61. module naming foo.Andy Wingo2009-05-221-110/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/ice-9/boot-9.scm (cond): Implement srfi-61; most of the code is from the SRFI itself. Yuk. (%print-module, make-modules-in, %app, (%app modules)) (module-name): Syncase needs to get at the names of modules, even at anonymous modules. So lazily assign gensyms as module names. Name %app as (%app), but since (%app modules) is at the top of the module hierarchy, name it (). * module/ice-9/psyntax.scm: When building tree-il, try to name lambdas in definitions and in lets. (let, letrec): Give more specific errors in a couple of cases. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syntax.test: More work. Many exceptions have different messages than they used to, many more generic; we can roll this back to be faithful to the original strings, but it doesn't seem necessary to me.
| | * some work on syntax.testAndy Wingo2009-05-211-16/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il.scm (tree-il->scheme): * module/ice-9/psyntax.scm (build-conditional): Attempt to not generate (if #f #f) as the second arm of an if, but it doesn't seem to be successful. * module/ice-9/psyntax-pp.scm (syntax-rules): Regenerate. * test-suite/tests/syntax.test (exception:unexpected-syntax): Change capitalization. ("unquote-splicing"): Update test. ("begin"): Add in second arms on these ifs, to avoid the strange though harmless expansion of `if'. (matches?): New helper macro. ("lambda"): Match on lexically bound symbols, as they will be alpha-renamed.
| | * catch syntax errors in unquote and unquote-splicingAndy Wingo2009-05-211-3/+8
| | | | | | | | | | | | | | | | | | | | | * module/ice-9/psyntax.scm (quasiquote): Catch syntax errors in unquote and unquote-splicing. * module/ice-9/psytax-pp.scm: Regenerated.
| | * fix apply and call/cc in drop contextsAndy Wingo2009-05-211-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il/compile-glil.scm (flatten): Actually apply only needs one arg after the proc. And shit, call/cc and apply in drop contexts also need to be able to return arbitrary numbers of values; work it by trampolining through their applicative (non-@) definitions. Also, simplify the single-valued drop case to avoid the truncate-values. * module/language/tree-il/inline.scm (call/cc): * module/language/tree-il/optimize.scm (*interesting-primitive-names*): Define call/cc as "interesting". Perhaps we should be hashing on value and not on variable. * test-suite/tests/tree-il.test ("application"): Fix up test for new, sleeker output. (Actually the GLIL is more verbose, but the assembly is better.) ("apply", "call/cc"): Add some more tests.
| | * procedures in "drop" contexts can return unspecified valuesAndy Wingo2009-05-212-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il/compile-glil.scm (flatten): For applications in "drop" context, allow the procedure to return unspecified values (including 0 values). * test-suite/tests/tree-il.test ("application"): Adapt test. * module/srfi/srfi-18.scm (wrap): Clarify. * test-suite/tests/srfi-18.test: Fix so that the expression importing srfi-18 is expanded before the tests. However the tests are still failing, something about 0-valued returns...
| | * fix srfi-17.testAndy Wingo2009-05-211-2/+5
| | | | | | | | | | | | | | | * test-suite/tests/srfi-17.test (exception:bad-quote): Change the expected exception for (set! (quote foo) ...) errors.
| | * fix failing macro-as-parameter tests in eval.testAndy Wingo2009-05-201-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/ice-9/psyntax.scm (chi-lambda-clause): Strip the docstring before passing it on to the continuation. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/eval.test (exception:failed-match): New exception, for syntax-case failed matches. ("evaluator"): Fix macro-as-parameter tests. They pass now :)
| | * remove compile-time-environmentAndy Wingo2009-05-201-39/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/ice-9/boot-9.scm (guile-user): Move the `compile' autoload to the guile-user module. Remove reference to compile-time-environment. * module/language/scheme/compile-ghil.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/optimize.scm: * module/system/base/compile.scm: * test-suite/tests/compiler.test: Remove definition of and references to compile-time-environment. While I do think that recompilation based on a lexical environment can be useful, I think it needs to be implemented differently. So for now we've lost nothing if we take it away, as it doesn't work with syncase anyway.
| | * don't allocate too many locals for expansions of `or'Andy Wingo2009-05-201-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il/analyze.scm (analyze-lexicals): Add in a hack to avoid allocating more locals than necessary for expansions of `or'. Documented in the source. * test-suite/tests/tree-il.test: Add a test case.
| | * and, or, cond etc use syntax-rules, compile scheme through tree-ilAndy Wingo2009-05-201-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/vm-i-system.c: * libguile/vm-engine.h (ASSERT_BOUND): New assertion, that a value is bound. Used by local-ref and external-ref in paranoid mode. * module/ice-9/boot-9.scm (and, or, cond, case, do): Since we are switching to use psyntax as the first pass of the compiler, and perhaps soon of the interpreter too, we need to make sure it expands out all forms to primitive expressions. So define expanders for these derived syntax forms, as in the R5RS report. * module/ice-9/psyntax-pp.scm: Regenerate, with core forms fully expanded. * module/ice-9/psyntax.scm (build-void): New constructor, for making undefined values. (build-primref): Add in a hack so that primitive refs in the boot module expand out to toplevel refs, not module refs. (chi-void): Use build-void. (if): Define an expander for if that calls build-conditional. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Use let* so as not to depend on binding order for the result of (current-module). * module/language/scheme/spec.scm (scheme): Switch over to tree-il as the primary intermediate language. Not yet fully tested, but at least it can compile psyntax-pp.scm. * module/language/tree-il/analyze.scm (analyze-lexicals): Arguments don't count towards a function's nlocs. * module/language/tree-il/compile-glil.scm (*comp-module*, compile-glil): Define a "compilation module" fluid. (flatten-lambda): Fix a call to make-glil-argument. Fix bug in heapifying arguments. (flatten): Fix number of arguments passed to apply instruction. Add a special case for `(values ...)'. If inlining primitive-refs fails, try expanding into toplevel-refs if the comp-module's variable is the same as the root variable. * module/language/tree-il/optimize.scm (resolve-primitives!): Add missing src variable for <module-ref>. * test-suite/tests/tree-il.test ("lambda"): Fix nlocs counts. Add a closure test case.
| | * add tree-il->glil compilation test suiteAndy Wingo2009-05-185-24/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/tree-il.scm (parse-tree-il): Fix a number of bugs. (unparse-tree-il): Apply takes rest args now. * module/language/tree-il/analyze.scm (analyze-lexicals) (analyze-lexicals): Heap vars shouldn't increment the number of locals. * module/language/tree-il/optimize.scm (resolve-primitives!): Don't resolve public refs to primitives, not at the moment anyway. * test-suite/Makefile.am (SCM_TESTS): Add tree-il test. * test-suite/lib.scm (pass-if, expect-fail, pass-if-exception) (expect-fail-exception): Rewrite as syntax-rules macros. In a very amusing turn of events, it turns out that bindings introduced by hygienic macros are not visible inside expansions produced by defmacros. This seems to be expected, so go ahead and work around the problem. * test-suite/tests/srfi-31.test ("rec special form"): Expand in eval. * test-suite/tests/syntax.test ("begin"): Do some more expanding in eval, though all is not yet well. * test-suite/tests/tree-il.test: New test suite, for tree-il->glil compilation.
| * | Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2.Ludovic Courtès2009-05-283-0/+988
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * README: Document dependency on GNU libunistring. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmark/bytevectors.bm'. * configure.in: Make sure we have libunistring; update $LIBS. * libguile.h: Include "bytevectors.h" and "r6rs-ports.h". * libguile/Makefile.am (libguile_la_SOURCES): Add `bytevectors.c' and `r6rs-ports.c' (DOT_X_FILES): Add `bytevectors.x' and `r6rs-ports.x'. (DOT_DOC_FILES): Add `bytevectors.doc' and `r6rs-ports.doc'. (noinst_HEADERS): Add `ieee-754.h'. (modinclude_HEADERS): Add `bytevectors.h' and `r6rs-ports.h' * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): New macro. * module/Makefile.am (SOURCES): Add $(RNRS_SOURCES). (RNRS_SOURCES): New variable. * test-suite/Makefile.am (SCM_TESTS): Add `bytevectors.test' and `r6rs-ports.test'.
| * | Remove possible deadlock in scm_join_thread_timedNeil Jerram2009-05-271-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/threads.c (scm_join_thread_timed): Recheck t->exited before looping round to call block_self again, in case thread t has now exited. * test-suite/tests/threads.test ("don't hang when joined thread terminates in SCM_TICK"): New test.
| * | Fix wait-condition-variable so that it doesn't leave asyncs blockedNeil Jerram2009-05-271-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/threads.c (fat_mutex_unlock): Unblock asyncs when breaking out of loop. * test-suite/tests/threads.test (asyncs-still-working?): New function, to test if asyncs are working (i.e. unblocked). Use this throughout threads.test, in particular before and after the "timed locking succeeds if mutex unlocked within timeout" test.
* | | Implementation of SRFI-98 (An interface to access environment variables).Julian Graham2009-05-301-0/+38
|/ / | | | | | | | | | | | | | | | | | | * NEWS: Add SRFI-98 to 1.8.7 features. * doc/ref/srfi-modules.text (SRFI-98): Documentation for SRFI-98. * module/srfi/srfi-98.scm: New file. SRFI-98 implementation. * test-suite/tests/srfi-98.test: New file. SRFI-98 unit tests.
* | Symbols longer than 128 chars can cause an exception. Also, the terminating ↵Michael Gran2009-05-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | colon of long postfix keywords are not handled correctly. * test-suite/tests/reader.test ("read-options"): Add test for long postfix keywords. * libguile/read.c (scm_read_mixed_case_symbol): Fix exception on symbols are greater than 128 chars. Also, colons are not stripped from long postfix keywords.