summaryrefslogtreecommitdiff
path: root/test-suite/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-09-09Compile Lua's ... form.Ian Price1-1/+1
* module/language/lua/compile-tree-il.scm (compile): Add clause for ast-variable-arguments. * module/language/lua/parser.scm (define-ast, make-parser): Add vararg-gensym field to functions, gensym field to variable-arguments. Propagate *vararg-gensym* from functions to variable-arguments. * test-suite/tests/lua-eval-2.test ("lua-eval"): Check for #nil
2013-09-09Fix typo in lua lexer test.Ian Price1-1/+1
* test-suite/tests/lua-lexer.test ("lua-lexer"): #:vararg -> #:varargs
2013-09-09Add some documentation. Function calls now properly handle multiplePhil4-14/+18
values resulting from a function call as the last argument. doc/ref/api-languages.texi: Add a small blurb about Lua. module/language/lua/compile-tree-il.scm: Function calls now properly handle multiple values resulting from a function call as the last argument.
2013-09-09module/language/lua/parser.scm: Rename #:dots to #:varargsPhil3-8/+8
2013-09-09Fix and/or double evaluation. Add math.modf, math.fmod.Phil1-0/+49
* module/language/lua/compile-tree-il.scm: Fix and/or double evaluation. * module/language/lua/notes.org: Add file describing known issues. * module/language/lua/parser.scm: (token-type): Recognize and/or. * module/language/lua/standard/math.scm: Add modf, fmod implementations. * test-suite/tests/lua-eval-3.test: Add another test file for basic language features.
2013-09-09lua/lexer tweaksAndy Wingo1-8/+5
* module/language/lua/lexer.scm: Some tweaks and reindentations. Remove the define/init lexer interface; I don't like separating declaration and initialization. * module/language/lua/parser.scm: * test-suite/tests/lua-lexer.test: Adapt to lexer interface change.
2013-09-09add lua language implementationNo Itisnt4-0/+379
What is missing: + Functions: module, getfenv, setfenv, math.modf, table.sort + Parser: needs to be more flexible + Compiler: needs more extensive work to properly handle all possible cases of variable arguments, multiple returns, and loops + Language: Variable arguments and unpacking of multiple returns. (For example we need to be able to handle something as complex as print(unpack({...})), which is easy with Lua's explicit stack but will require lots of tree-il gymnastics, or perhaps modifications to better allow different calling conventions. (For instance -- how would we support Python or Ruby, where keyword arguments are gathered into a hashtable and passed as a single argument?) What is there: A fair shot at supporting Lua 5.1, not quite a drop-in replacement, but not far from that goal either.
2013-08-31Add CPS -> RTL compilerAndy Wingo1-0/+200
* module/Makefile.am: * module/language/cps/compile-rtl.scm: * module/language/cps/dfg.scm: * module/language/cps/slot-allocation.scm: New modules. * module/language/cps/spec.scm: Register the compiler. * test-suite/Makefile.am: * test-suite/tests/rtl-compilation.test: Add tests.
2013-08-24RTL: 'return-values' instruction assumes 'reset-frame' has been called.Mark H Weaver1-1/+2
* libguile/vm-engine.c (return-values): Remove NVALUES operand. Don't reset the frame. * test-suite/tests/rtl.test ("cached-toplevel-set!"): Adapt to the fact that 'return-values' has no operand now, and that 'reset-frame' must be done first.
2013-08-23Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-0/+4
2013-08-19`write-request-line' always prints a path component.Ian Price1-0/+4
* module/web/http.scm (write-request-line): Always write "/" when path is empty, regardless of query. * test-suite/tests/web-http.test ("write-request-line"): Add test.
2013-08-16In bytevector->uint-list et al, check that SIZE divides the bv length.Mark H Weaver1-8/+3
Fixes <http://bugs.gnu.org/15100>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/bytevectors.c (INTEGERS_TO_LIST): Enforce the R6RS requirement that SIZE divides the bytevector length. * test-suite/tests/bytevectors.test: Add test. Remove tests that assumes that this "divides" check is not enforced.
2013-08-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+9
2013-08-16Improved error checking in bytevector->uint-list and bytevector->sint-list.Mark H Weaver1-1/+9
Partially fixes <http://bugs.gnu.org/15100>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0. Allow SIZE to be greater than the bytevector length, for consistency with allowing extra bytes at the end when the bytevector length is non-zero. Use scm_from_size_t instead of scm_from_uint. * test-suite/tests/bytevectors.test: Add tests. Remove a test that checks for an exception when SIZE is greater than the bytevector length.
2013-08-13Adapt peval.test to recent associativity fixes of numeric ops.Mark H Weaver1-12/+9
* test-suite/tests/peval.test ("partial evaluation"): Adapt tests to the fact that arithmetic operators are now expanded into binary ops with left-to-right associativity.
2013-08-11Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver4-61/+49
2013-08-11Broken Turkish UTF-8 locale still unresolved in FreeBSD 9.1.Mark H Weaver1-4/+6
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Disable tests of Turkish UTF-8 locale in FreeBSD 9.1.
2013-08-11Various RTL VM and calling convention tweaksAndy Wingo1-30/+35
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Allow for five-word instructions, and for new instruction word types. * libguile/vm-engine.c (RETURN_ONE_VALUE): Instead of returning the value in the fixed part of the call frame, return it in the same place multiple-value returns go: from slot 1. (BR_ARITHMETIC): Allow arithmetic tests to be negated. (rtl_vm_engine): Change calling convention to use the same location for single and multiple-value returns. Renumber all instructions. (halt, halt/values): Fold into a single instruction (halt). (call): Take the location of the procedure instead of the location of the call frame. Also take the number of args, and reset the sp before jumping to the procedure, so as to indicate the number of arguments. (call/values): Remove, as the new calling convention has RA == MVRA. (tail-call): Require the procedure to be shuffled down already, and take "nlocals" as an arg instead of "nargs". (receive, receive-values): New instructions, for receiving returned values from calls. (return-values): Rename from return/values. Remove "values". (alloc-frame): Rename from reserve-locals. (reset-frame): New instruction. (drop-locals): Remove. (br-if-=, br-if-<, br-if-<=): Allow these instructions to be negatable. (br-if->, br-if->=): Remove. Probably a bad idea, given NaN. (box-ref): Don't bother trying to do a reverse lookup -- the toplevel-box, module-box, and resolve instructions should handle that. (resolve): Add arg to check that the variable is bound. (toplevel-box, module-box): New instructions, replacing toplevel-ref, toplevel-set, module-ref, and module-set. * libguile/vm.c (rtl_boot_continuation_code, rtl_values_code): Adapt to instruction set changes. * module/Makefile.am: Make the assembler and disassembler dependent on vm-operations.h. * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm: Adapt to instruction changes and new instruction word kinds. * test-suite/tests/rtl.test: Adapt to instruction set changes.
2013-08-11Inline escape-only prompt bodies in the Tree-ILAndy Wingo1-4/+1
* module/language/scheme/decompile-tree-il.scm (do-decompile): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/peval.scm (peval): * test-suite/tests/peval.test ("partial evaluation"): Partially revert 178a40928, so that escape-only prompts explicitly inline their bodies.
2013-08-11remove peval abort-in-tail-position optimizationAndy Wingo1-0/+3
* module/language/tree-il/peval.scm (peval): Remove abort optimization; the CPS compiler will do much better here, and it is complicating things in the meantime.
2013-08-09dereference-pointer: check for null pointer.Mark H Weaver1-0/+4
* libguile/foreign.c (scm_dereference_pointer): Check for attempts to dereference a null pointer. * test-suite/tests/foreign.test ("null pointer"): Add test.
2013-08-09Fix numerator and denominator handling of signed zeroes and infinities.Mark H Weaver2-57/+39
* libguile/numbers.c (scm_numerator, scm_denominator): Handle signed zeroes and infinities in accordance with the corresponding R6RS flonum procedures. * module/rnrs/arithmetic/flonums.scm (flnumerator, fldenominator): Remove special handling of infinities. * test-suite/tests/numbers.test (numerator, denominator): Add tests. Convert existing tests to use 'pass-if-equal'. * test-suite/tests/r6rs-arithmetic-flonums.test (flnumerator): Fix broken test of (flnumerator -0.0).
2013-08-07String ports use UTF-8; ignore %default-port-encoding.Mark H Weaver9-357/+310
* libguile/strports.c (scm_mkstrport): Use UTF-8; ignore %default-port-encoding. Rename 'str_len' and 'c_pos' to 'num_bytes' and 'c_byte_pos'. Interpret 'pos' argument as a character index instead of a byte index. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the list of core features. * module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply re-export these, since the core versions are now compliant. * doc/ref/api-io.texi (String Ports): Remove text that describes non-compliant behavior of string ports with regard to encoding. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of core features. (SRFI-6): Remove text that mentions non-compliant behavior of core string ports. * module/ice-9/format.scm (format): * module/ice-9/pretty-print.scm (truncated-print): * module/rnrs/io/ports.scm (open-string-input-port, open-string-output-port): * test-suite/test-suite/lib.scm (format-test-name): * test-suite/tests/chars.test ("combining accent is pretty-printed", "combining X is pretty-printed"): * test-suite/tests/ecmascript.test (eread, eread/1): * test-suite/tests/rdelim.test: * test-suite/tests/reader.test (read-string): * test-suite/tests/regexp.test: * test-suite/tests/srfi-105.test (read-string): Don't set %default-port-encoding before creating string ports. * benchmark-suite/benchmarks/ports.bm (%latin1-port): Use 'set-port-encoding!' to set the string port encoding. (%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set %default-port-encoding before creating string ports. * test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set %default-port-encoding before creating string ports. ("put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"): Use 'set-port-encoding!' to set the string port encoding. * test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set the string port encoding. ("truncated-print"): Use 'pass-if-equal'. * test-suite/tests/ports.test ("encoding failure leads to exception", "%default-port-encoding is honored", "peek-char [latin-1]", "peek-char [utf-8]", "peek-char [utf-16]"): Remove tests. ("%default-port-encoding is ignored", "peek-char"): Add tests. ("suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding, error", "wrong encoding, substitute", "wrong encoding, escape"): Use 'set-port-encoding!' to set the string port encoding. ("%default-port-encoding, wrong encoding"): Rewrite to use a file port instead of a string port.
2013-08-06Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver4-4/+33
Conflicts: libguile/numbers.c libguile/vm-i-scheme.c
2013-07-21call is no longer a vararg instructionAndy Wingo1-5/+9
* libguile/vm-engine.c (push_frame, call): Separate out push_frame from call, and expect the caller to arrange the proc and arguments. * test-suite/tests/rtl.test ("call"): Update tests.
2013-07-21RTL: Local 0 is the procedureAndy Wingo1-101/+102
* libguile/vm-engine.c: Change the RTL VM to number the procedure as local 0, and other locals from 1. In the future we will want the FP to point to local 0 instead of local 1. In the future also we can elide the procedure for well-known closures (closures in which all references are known call sites). (make_closure, free_set): Instead of taking rest arguments, we add a new free-set! op that initializes closures. (free_ref): Take the closure as an argument. * libguile/vm.c (rtl_boot_continuation_code): Remove comments, which were out of date. (rtl_apply_code, rtl_values_code): Update comments. * module/system/vm/assembler.scm (intern-constant, emit-init-constants): Adapt to locals numbering change. (begin-kw-arity): For assert-nargs-ee purposes, nreq includes the procedure. * module/system/vm/disassembler.scm (code-annotation): Adapt annotation for assert-nargs-ee/locals. * test-suite/tests/rtl.test: Adapt tests.
2013-07-21Optimize R6RS bitwise operators.Mark H Weaver2-2/+2
* module/rnrs/arithmetic/bitwise.scm (bitwise-if, bitwise-length, bitwise-first-bit-set, bitwise-bit-field, bitwise-reverse-bit-field): Replace these with aliases to the identical SRFI-60 operators 'bitwise-if', 'integer-length', 'first-set-bit', 'bit-field', and 'reverse-bit-field'. (bitwise-copy-bit, bitwise-copy-bit-field, bitwise-rotate-bit-field): Reimplement these based upon the similar SRFI-60 operators 'copy-bit', 'copy-bit-field', and 'rotate-bit-field'. * test-suite/tests/r6rs-arithmetic-bitwise.test (bitwise-copy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1. * test-suite/tests/r6rs-arithmetic-fixnums.test (fxcopy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1.
2013-07-21Fix incorrect rationalize tests.Mark H Weaver1-2/+2
* test-suite/tests/fractions.test (fractions): Fix rationalize tests.
2013-07-21Rewrite 'rationalize' to fix bugs and improve efficiency.Mark H Weaver1-0/+29
Fixes <http://bugs.gnu.org/14905>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/numbers.c (scm_rationalize): Rewrite. Previously an incorrect algorithm was used which failed in many cases. * test-suite/tests/numbers.test (rationalize): Add tests.
2013-07-18Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver3-4/+14
2013-07-16Fix R6RS 'fixnum-width'.Mark H Weaver1-0/+8
Fixes <http://bugs.gnu.org/14879>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/fixnums.scm (fixnum-width): Rewrite to avoid inexact arithmetic, and correct the off-by-one error. * test-suite/tests/r6rs-arithmetic-fixnums.test (fixnum-width): Add tests.
2013-07-16Update copyright dates of recently-changed R6RS bitwise/flonums files.Mark H Weaver2-2/+2
* module/rnrs/arithmetic/bitwise.scm: module/rnrs/arithmetic/flonums.scm: test-suite/tests/r6rs-arithmetic-bitwise.test: test-suite/tests/r6rs-arithmetic-flonums.test: Add 2013 to the copyright dates.
2013-07-16Fix 'fxbit-count' for negative arguments.Mark H Weaver1-2/+4
Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/fixnums.scm (fxbit-count): If the argument is negative, return the 'bitwise-not' of the result of 'logcount', as per R6RS. Previously, 'fxbit-count' was identical to 'logcount'. * test-suite/tests/r6rs-arithmetic-fixnums.test (fxbit-count): Add test.
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-22/+99
Conflicts: libguile/numbers.c
2013-07-16gcd and lcm support inexact integer arguments.Mark H Weaver1-2/+60
Fixes <http://bugs.gnu.org/14870>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/numbers.c (scm_gcd, scm_lcm): Support inexact integers. * test-suite/tests/numbers.test (gcd, lcm): Add tests.
2013-07-16min and max: NaNs beat infinities, per R6RS errata.Mark H Weaver1-8/+8
Fixes <http://bugs.gnu.org/14865>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/numbers.c (scm_min, scm_max): NaNs beat infinities, as per the R6RS errata. * test-suite/tests/numbers.test (min, max): Update tests.
2013-07-16Flonum operations always return flonums.Mark H Weaver1-8/+19
Fixes <http://bugs.gnu.org/14871>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (ensure-flonum): New procedure. (fllog): Rewrite using case-lambda. Handle negative zeroes. Use 'ensure-flonum'. (flatan): Rewrite using case-lambda. (flasin, flacos, flsqrt, flexpt): Use 'ensure-flonum'. * test-suite/tests/r6rs-arithmetic-flonums.test (fllog, flasin, flacos, flsqrt, flexpt): Add tests.
2013-07-16flfinite? applied to a NaN returns false.Mark H Weaver1-1/+4
Fixes <http://bugs.gnu.org/14868>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a NaN, return false. * test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test.
2013-07-16flonum? returns false for complex number objects.Mark H Weaver1-1/+4
Fixes <http://bugs.gnu.org/14866>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (flonum?): Use 'real?' instead of 'number?'. * test-suite/tests/r6rs-arithmetic-flonums.test (flonum?): Add tests.
2013-07-16Allow fl+ and fl* to accept zero arguments.Mark H Weaver1-2/+4
Fixes <http://bugs.gnu.org/14869>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (fl+, fl*): Accept zero arguments. * test-suite/tests/r6rs-arithmetic-flonums.test (fl+, fl*): Add tests.
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-2/+2
2013-07-16numbers.test: Fix inum/flonum comparison test on 32-bit machines.Mark H Weaver1-2/+2
* test-suite/tests/numbers.test (<): Fix inum/flonum test.
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver7-49/+146
Conflicts: libguile/keywords.c libguile/vm.c
2013-07-16Avoid lossy conversion from inum to double in numerical comparisons.Mark H Weaver1-0/+39
* libguile/numbers.c (scm_less_p): Avoid converting inums to doubles. * test-suite/tests/numbers.test (<): Add tests.
2013-07-16numbers.test: Avoid inexact arithmetic in computation of fixnum-bit.Mark H Weaver1-1/+4
* test-suite/tests/numbers.test (fixnum-bit): Rewrite to avoid inexact arithmetic.
2013-07-16Fix bugs in numerical equality predicate.Mark H Weaver1-1/+25
* libguile/numbers.c (scm_num_eq_p): Fix bug comparing fractions to infinities (reported by Göran Weinholt <goran@weinholt.se>). Fix erroneous comment describing the logic behind inum/flonum comparison. Use similar logic for inum/complex comparison to avoid rounding errors. Make minor indentation fixes and simplifications. * test-suite/tests/numbers.test (=): Add tests.
2013-07-16Fix rounding in scm_i_divide2double for negative arguments.Mark H Weaver1-0/+13
* libguile/numbers.c (INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE): New macro. (scm_i_divide2double): Use INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE to determine if our fast path is safe. Previously, negative arguments were not checked properly. * test-suite/tests/numbers.test (exact->inexact): Add tests.
2013-07-14Fix 'bitwise-bit-count' for negative arguments.Mark H Weaver1-1/+3
Fixes <http://bugs.gnu.org/14864>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/bitwise.scm (bitwise-bit-count): If the argument is negative, return the 'bitwise-not' of the result of 'logcount', as per R6RS. Previously, 'bitwise-bit-count' was identical to 'logcount'.
2013-07-06<prompt> body and handler are lambdas; add escape-only? fieldAndy Wingo1-16/+20
* module/language/tree-il.scm (<prompt>): Change to have the body and handler be lambdas, and add an "escape-only?" field. This will make generic prompts work better in CPS or ANF with the RTL VM, as it doesn't make sense in that context to capture only part of a frame. Escape-only prompts can still be fully inlined. (parse-tree-il, unparse-tree-il): Add escape-only? to the serialization. (make-tree-il-folder, pre-post-order): Deal with escape-only?. * module/language/tree-il/analyze.scm (analyze-lexicals): Handle escape-only?, and the new expectations for the body and handler. * module/language/tree-il/canonicalize.scm (canonicalize): Ensure that the body of an escape-only continuation is a thunk, and that the handler is always a lambda. * module/language/tree-il/debug.scm (verify-tree-il): Assert that escape-only? is a boolean. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*primitive-expand-table*): * test-suite/tests/peval.test ("partial evaluation"): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Adapt to <prompt> change.
2013-06-27dynamic-wind in terms of wind and unwind; remove <dynwind>, @dynamic-windAndy Wingo1-24/+30
* doc/ref/compiler.texi: Remove mention of <dynwind>. * libguile/eval.c (eval): Remove SCM_M_DYNWIND case. * libguile/expand.c: Remove scm_sym_at_dynamic_wind. * libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If we see a wind or unwind primcall, we expand to a call of a quoted subr value. It works and removes a kind of memoized value from the interpreter. For the compiler,primcalls to wind and unwind are handled specially. (MAKMEMO_DYNWIND): Remove. (scm_tc16_memoizer): Remove. Yay! (memoize): Remove speculative lookup for toplevels to see if they are memoizers: there are no more memoizers. Memoize calls to the wind and unwind primitives. (m_dynamic_wind): Remove. (unmemoize): Remove dynwind case. (scm_init_memoize): Add wind and unwind local definitions. * module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind" and "unwind" primitives. These primitives are not exposed to other modules. * module/ice-9/eval.scm (primitive-eval): Remove dynwind case. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynwind cases. * module/language/tree-il.scm: Remove <dynwind>. Yaaay! * module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind cases. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind and unwind. (flatten-lambda-case): Remove dynwind case. Yay! * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (singly-valued-expression?, peval): Remove <dywind> cases. Inline primcalls to dynamic-wind. Add constant folding for thunk?. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Remove @dynamic-wind, and add procedure? and thunk?. (*effect+exception-free-primitives*): Add procedure? and thunk?. (*multiply-valued-primitives*): Remove @dynamic-wind. Remove @dynamic-wind expander. * test-suite/tests/peval.test ("partial evaluation"): Update tests for dynwind desugaring.