summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-08-14temp commitwip-sassyAndy Wingo4-3/+520
2009-08-13add the sassy x86 assemblerAndy Wingo479-0/+12853
* module/Makefile.am: Add language/sassy.scm. Probably EXTRA_DIST the dependant files, too. * module/language/sassy.scm: New file, the sassy loader. Sassy is originally R5RS code that loads a number of files. I've converted that toplevel file to be a Guile module that *includes* the subfiles, so that it all gets compiled together. It's a pretty bad hack though, because what I should be doing is including them relative to the sassy.scm source location, but we don't know that at expansion time. Something to fix. really bad hack in it so that it will compile correctly -- p * module/language/sassy/: All the sassy files and some changelog information. All of these files are LGPLv2.1+, so they can be included in Guile. * test-suite/standalone/sassy/tests/: Add the sassy unit tests. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-sassy: Hook the sassy unit tests up to our test suite.
2009-08-13compiler.test: Enforce evaluation order.Ludovic Courtès1-9/+11
* test-suite/tests/compiler.test ("psyntax")["redefinition", "compile in current module", "compile in fresh module"]: Use `begin' to enforce evaluation order. Thanks Andy!
2009-08-13Allow fresh modules to be passed to `compile'.Ludovic Courtès3-6/+34
* module/ice-9/boot-9.scm (module-name): When making MOD non-anonymous, bind it in the `(%app modules)' name space. * test-suite/tests/compiler.test ("psyntax")["compile in current module", "compile in fresh module"]: New tests. * test-suite/tests/modules.test ("foundations")["modules don't remain anonymous"]: New test.
2009-08-13Allow redefinitions in compiled code as in `(define round round)'.Ludovic Courtès3-5105/+5987
* 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.
2009-08-12update docs for recent vm/compiler workAndy Wingo3-169/+317
* doc/ref/compiler.texi: * doc/ref/vm.texi: Update for recent changes. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't print nops, they are distracting.
2009-08-12"fix" <let>-bound lambda expressions tooAndy Wingo4-18/+85
* 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.
2009-08-12Don't include libunistring headers in Guile public headersMichael Gran5-8/+29
This requres the creation of a new type scm_t_string_failed_conversion_handler to replace libunistring's enum iconveh_ilseq_handler. * libguile/strings.h: don't include <uniconv.h> (scm_t_string_failed_conversion_handler): new enum type (SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK): (SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values * libguile/strings.c (scm_to_stringn): now takes type scm_t_string_failed_conversion_handler. All callers changed. * libguile/print.c: include <uniconv.h> * libguile/ports.c (scm_lfwrite_substr): use scm_t_string_conversion_handler's constants * libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR): (SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store iconveh_ilseq_hander constants as #define's
2009-08-12Regression, scm_string fails to test for circular listsMichael Gran2-2/+13
* 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
2009-08-12Some signed/unsigned comparison and conversionsMichael Gran2-3/+3
* libguile/ports.c (scm_lfwrite_str, scm_lfwrite_substr): signed/unsigned conversion and comparison * libguile/strings.c (scm_string_append): signed/unsigned comparison
2009-08-12rework the vm support for wide stringsAndy Wingo11-199/+99
* 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.
2009-08-12Fix disassembly of strings and symbolsMichael Gran1-2/+22
* module/language/assembly/decompile-bytecode.scm (decode-bytecode): fix disassembly of strings, symbols, keywords, and defines
2009-08-11Quiet signed/unsigned comparison warnings in chars.[ch]Michael Gran2-5/+5
* libguile/chars.h (SCM_MAKE_CHAR): quiet signed/unsigned comparison warnings * libguile/chars.c (scm_i_charname): (scm_i_charname_to_char): quiet signed/unsigned comparison warnings
2009-08-11Avoid unitialized and unused warnings in scm_string_appendMichael Gran1-9/+13
* libguile/strings.c (scm_string_append): avoid warnings
2009-08-11Revert to locale-dependent toupper and tolowerMichael Gran1-2/+8
To avoid leaving Guile in a broken state, the conversion from locale-dependent case modification to Unicode case modification should be an atomic commit * libguile/chars.c (scm_c_upcase): revert to locale-dependent toupper and tolower
2009-08-11Only pass ints to tolower and toupperMichael Gran2-9/+9
* libguile/strings.c (unistring_escapes_to_guile_escapes): cast tolower's parameter to int * libguile/read.c (CHAR_DOWNCASE): cast tolower's parameter to int
2009-08-12debitrot the ecmascript compilerAndy Wingo5-565/+553
* module/Makefile.am (ECMASCRIPT_LANG_SOURCES): * module/language/ecmascript/compile-ghil.scm: * module/language/ecmascript/compile-tree-il.scm: SOURCES): Replace the GHIL compiler with a ->tree-il compiler. Not fully functional, but the basics work. * module/language/ecmascript/spec.scm: Only include the tree-il compiler. * module/language/ecmascript/tokenize.scm (read-punctuation): Avoid mutating a constant.
2009-08-11make the fallback path look less like line noiseAndy Wingo2-3/+16
* libguile/_scm.h: * libguile/load.c: Rework to only include the relevant pieces in the fallback path.
2009-08-11include objcode cookie in the fallback pathAndy Wingo3-30/+30
* libguile/_scm.h (SCM_OBJCODE_COOKIE): Move the objcode cookie define here, so that load.c can use it. This is a private header. * libguile/load.c (FALLBACK_DIR): Include the objcode cookie in the fallback path. Should fix problems when objcode changes incompatibly during the 1.9 series. * libguile/objcodes.c: Adapt to SCM_OBJCODE_COOKIE move. This should fix http://article.gmane.org/gmane.lisp.guile.devel/9059.
2009-08-10More string and symbol testsMichael Gran2-7/+317
* test-suite/tests/strings.test: more tests * test-suite/tests/symbols.test: more tests
2009-08-10Fix %string-dump and %symbol-dump fieldsMichael Gran1-11/+13
* libguile/strings.c (scm_sys_string_dump): don't print stringbuf. Print read-only status. (scm_sys_symbol_dump): don't print stringbuf. Print interned status.
2009-08-10Change `defined?' to accept a module as its second argument.Ludovic Courtès2-41/+21
Reported by Daniel Kraft <d@domob.eu>. * doc/ref/api-binding.texi (Binding Reflection): Update documentation of `defined?'. * libguile/evalext.c (scm_defined_p): Expect a module as the second argument, not a lexical environment.
2009-08-10Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL.Michael Gran3-4/+4
Also, scm_charprint is renamed to scm_i_charprint. * libguile/strings.h: make scm_i_string_wide_chars internal. * libguile/print.h: rename scm_charprint to scm_i_charprint. Make internal. * libguile/print.c (scm_i_charprint): renamed from scm_charprint (scm_charprint): renamed to scm_i_charprint. All callers changed.
2009-08-10Improve %string-dump and %symbol-dumpMichael Gran2-57/+181
%string-dump and %symbol-dump are modified to return assocation lists of string and symbol attributes instead of printing to stderr. They are no longer conditional on SCM_DEBUG. * libguile/strings.c (scm_sys_string_dump) (scm_sys_symbol_dump): now returns alist of properties. No longer require that SCM_DEBUG be defined. (scm_sys_stringbuf_hist): now conditional on SCM_STRING_LENGTH_HISTOGRAM * libguile/strings.h: scm_sys_string_dump and scm_sys_symbol dump are now declared as API
2009-08-09More comments for string functionsMichael Gran1-16/+59
* libguile/strings.c: comments
2009-08-09Missing parentheses in SCM_MAKE_CHAR macroMichael Gran1-3/+3
* libguile/chars.h (SCM_MAKE_CHAR): missing parentheses
2009-08-09Port position macros shouldn't require enclosing bracesMichael Gran2-22/+11
The port position macros incorrectly required enclosing braces when used within if statements. * libguile/ports.h (SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL) (SCM_DECCOL, SCM_TABCOL): enclose macro in do/while * libguile/ports.c (update_port_lf): remove extra braces
2009-08-09Use a linker version script for libguile.Ludovic Courtès2-1/+52
* libguile/Makefile.am (libguile_la_LDFLAGS)[HAVE_LD_VERSION_SCRIPT]: Use `libguile.map'. (EXTRA_DIST): Add `libguile.map'. * libguile/libguile.map: New file.
2009-08-09Use Gnulib's `lib-symbol-versions' module.Ludovic Courtès9-14/+77
* m4/gnulib-cache.m4: Add `lib-symbol-versions'.
2009-08-09Remove bogus `configure' test for GNU libunistring.Ludovic Courtès1-7/+1
* configure.ac: Remove explicit test for libunistring, which conflicted with Gnulib's own test. This fixes commit f4863880f5ef539cb545999c19b6b5c0eec9382d.
2009-08-08Merge commit 'origin/master'Michael Gran19-410/+1107
2009-08-08Add Unicode strings and symbolsMichael Gran15-306/+1046
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
2009-08-07lambda, the ultimate gotoAndy Wingo2-39/+155
* module/language/tree-il/analyze.scm (analyze-lexicals): Rework to actually determine when a fixed-point procedure may be allocated as a label. * module/language/tree-il/compile-glil.scm (emit-bindings): Always emit a <glil-bind>. Otherwise it's too hard to pair with unbindings. (flatten-lambda): Consequently, here we only `bind' if there are any vars to bind. This doesn't make any difference, given that lambdas don't have trailing unbind instructions, but it does keep the GLIL output the same for thunks -- no extraneous (bind) instructions. Keeps tree-il.test happy. (flatten): Some bugfixes. Yaaay, it works!!!
2009-08-07implement compilation of label-allocated lambda expressionsAndy Wingo1-129/+195
* module/language/tree-il/compile-glil.scm (flatten-lambda, flatten): Implement compilation of label-allocated lambda expressions. Quite tricky, we'll see if this works when the new analyzer lands.
2009-08-07add label alist to lambda allocations in tree-il->glil compilerAndy Wingo2-17/+47
* module/language/tree-il/analyze.scm: Add some more comments about something that will land in a future commit: compiling fixpoint lambdas as labels. (analyze-lexicals): Reorder a bit, and add a label alist to procedure allocations. Empty for now. * module/language/tree-il/compile-glil.scm (flatten): Adapt to the free variables being in the cddr of the allocation, not the cdr.
2009-08-06loop detection in the houseAndy Wingo3-23/+54
* libguile/vm-i-scheme.c (vector-ref, vector-set): Sync registers if we call out to C. * module/language/tree-il/compile-glil.scm (flatten-lambda): Add an extra argument, the self-label, which should be the gensym under which the procedure is bound in a <fix> expression. (flatten): If we see a call to a lexical ref to the self-label in a tail position, rename and goto instead of goto/args, which will tear down the frame -- or will, in the future. It's a primitive form of loop detection. * module/language/tree-il/primitives.scm (zero?): Expand to (= x 0).
2009-08-06actually implement "fixing letrec"Andy Wingo7-82/+252
* module/Makefile.am (SOURCES): Reorganize so GHIL is compiled last, along with ecmascript. * module/language/scheme/spec.scm: Remove references to GHIL, as it's bitrotten and obsolete.. * module/language/tree-il.scm (make-tree-il-folder): Rework so that we only have down and up procs, and call down and up on each element. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a thinko handling let-values. * module/language/tree-il/fix-letrec.scm: Actually implement fixing letrec. The resulting code will perform better, but violations of the letrec restriction are not detected. This behavior is allowed by the spec, but it is undesirable. Perhaps that will be fixed later. * module/language/tree-il/inline.scm (inline!): Fix a case in which ((lambda args foo)) would be erroneously inlined to foo. Remove empty let, letrec, and fix statements. * module/language/tree-il/primitives.scm (effect-free-primitive?): New public predicate.
2009-08-06actually inline call-with-values to tree-il's <let-values>Andy Wingo4-21/+59
* module/srfi/srfi-11.scm (let-values): In the one-clause case, avoid going through temporary variables. * module/language/tree-il/inline.scm (inline!): Add another case: (call-with-values (lambda () ...) (lambda ... ...) -> let-values. * module/language/tree-il/compile-glil.scm (flatten): Fix a bug compiling applications in "vals" context. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a couple bugs with let-values and rest arguments.
2009-08-05let-values in terms of syntax-case, add make-tree-il-folderAndy Wingo4-189/+194
* module/language/tree-il.scm (tree-il-fold): Fix for let-values case. (make-tree-il-folder): New public macro, makes a multi-valued folder specific to the number of seeds that the user wants. * module/language/tree-il/optimize.scm (optimize!): Reverse the order of inline! and fix-letrec!, as the latter might expose opportunities for the former. * module/srfi/srfi-11.scm (let-values): Reimplement in terms of syntax-case, so that its expressions may reference hygienically bound variables. See the NEWS for the rationale. (let*-values): An empty let*-values still introduces a local `let' binding contour. * module/system/base/syntax.scm (record-case): Yukkkk. Reimplement in terms of syntax-case. Ug-ly, but see the NEWS again: "Lexical bindings introduced by hygienic macros may not be referenced by nonhygienic macros."
2009-08-05add <fix> tree-il construct, and compile itAndy Wingo9-44/+189
* libguile/vm-i-system.c (fix-closure): New instruction, for wiring together fixpoint procedures. * module/Makefile.am (TREE_IL_LANG_SOURCES): Add fix-letrec.scm. * module/language/glil/compile-assembly.scm (glil->assembly): Reindent the <glil-lexical> case, and handle 'fix for locally-bound vars. * module/language/tree-il.scm (<fix>): Add the <fix> tree-il type and accessors, for fixed-point bindings. This IL construct is taken from the Waddell paper. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (pre-order!, post-order!): Update for <fix>. * module/language/tree-il/analyze.scm (analyze-lexicals): Update for <fix>. The difference here is that the bindings may not be assigned, and are not marked as such. They are not boxed. (report-unused-variables): Update for <fix>. * module/language/tree-il/compile-glil.scm (flatten): Compile <fix> to GLIL. * module/language/tree-il/fix-letrec.scm: A stub implementation of fixing letrec -- will flesh out in a separate commit. * module/language/tree-il/inline.scm: Fix license, it was mistakenly added with LGPL v2.1+. * module/language/tree-il/optimize.scm (optimize!): Run the fix-letrec! pass.
2009-08-05add a brain-dead inlinerAndy Wingo3-11/+49
* module/Makefile.am (TREE_IL_LANG_SOURCES): * module/language/tree-il/inline.scm: Add a brain-dead inliner, to inline ((lambda () x)) => x. * module/language/tree-il/optimize.scm (optimize!): Invoke the inliner.
2009-08-05add1 and sub1 instructionsAndy Wingo4-6/+52
* 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.
2009-08-04perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGSAndy Wingo2-14/+11
* configure.ac: Rework gmp and unistring checks to use AC_LIB_HAVE_LINKFLAGS, so that the compilation checks run with the right -L/-l flags. * libguile/Makefile.am (libguile_la_LIBADD): Adapt to need to add $(LIBGMP) and $(LIBUNISTRING) here. Hopefully this solves http://article.gmane.org/gmane.lisp.guile.bugs/4288.
2009-08-04rename configure.in to configure.acAndy Wingo2-0/+0
* configure.ac: * guile-readline/configure.ac: Rename from configure.in, as recommended by the autoconf manual.
2009-08-04fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+Andy Wingo1-1/+16
* libguile/numbers.c (mem2decimal_from_point, mem2ureal, mem2complex): Fix a number of cases where, for invalid numbers, we could read past the end of the buffer. This happened in e.g. "1.0+", "1/" and "1.0f". But I couldn't figure out how to test for these, given that the behavior depended on the contents of uninitialized memory in the reader buffer. We'll just have to be happy with this. Thanks to Kjetil S. Matheussen for the report.
2009-08-01Don't doubly define scm_t_wcharMichael Gran2-9/+1
* libguile/chars.h: don't define scm_t_wchar * libguile/numbers.h: define scm_t_wchar here
2009-08-01Fix coding style compliance for recent 32-bit char changesMichael Gran2-15/+9
* libguile/print.c (iprin1): extra braces * libguile/chars.h (SCM_IS_UNICODE_CHAR): coding style
2009-08-01Don't use GNU extensions for SCM_MAKE_CHAR macroMichael Gran2-5/+11
Since the contents of SCM_MAKE_CHAR are evaluated more than once, don't use it in situations where this could cause side-effects. * libguile/vm-i-system.c (make-char8): avoid side-effects with SCM_MAKE_CHAR call * libguile/chars.h (SCM_MAKE_CHAR): modified
2009-08-01Make charname declarations module-level and GCSMichael Gran1-48/+42
Charname array declarations are corrected for style and are made module-level. Array list length variables are replaced with macros. * libguile/chars.c: variable declaration fixes
2009-08-01Update NEWS for charname changesMichael Gran1-0/+15
* NEWS: updated