bpt/guile.git
14 years agoMake scm_charprint and scm_i_string_wide_chars SCM_INTERNAL.
Michael Gran [Mon, 10 Aug 2009 12:51:05 +0000 (05:51 -0700)]
Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL.

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.

14 years agoImprove %string-dump and %symbol-dump
Michael Gran [Mon, 10 Aug 2009 07:09:33 +0000 (00:09 -0700)]
Improve %string-dump and %symbol-dump

%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

14 years agoMore comments for string functions
Michael Gran [Mon, 10 Aug 2009 01:06:59 +0000 (18:06 -0700)]
More comments for string functions

        * libguile/strings.c: comments

14 years agoMissing parentheses in SCM_MAKE_CHAR macro
Michael Gran [Sun, 9 Aug 2009 23:01:20 +0000 (16:01 -0700)]
Missing parentheses in SCM_MAKE_CHAR macro

* libguile/chars.h (SCM_MAKE_CHAR): missing parentheses

14 years agoPort position macros shouldn't require enclosing braces
Michael Gran [Sun, 9 Aug 2009 22:58:49 +0000 (15:58 -0700)]
Port position macros shouldn't require enclosing braces

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

14 years agoUse a linker version script for libguile.
Ludovic Courtès [Sun, 9 Aug 2009 21:40:11 +0000 (23:40 +0200)]
Use a linker version script for libguile.

* libguile/Makefile.am (libguile_la_LDFLAGS)[HAVE_LD_VERSION_SCRIPT]:
  Use `libguile.map'.
  (EXTRA_DIST): Add `libguile.map'.

* libguile/libguile.map: New file.

14 years agoUse Gnulib's `lib-symbol-versions' module.
Ludovic Courtès [Sun, 9 Aug 2009 21:05:37 +0000 (23:05 +0200)]
Use Gnulib's `lib-symbol-versions' module.

* m4/gnulib-cache.m4: Add `lib-symbol-versions'.

14 years agoRemove bogus `configure' test for GNU libunistring.
Ludovic Courtès [Sun, 9 Aug 2009 18:21:41 +0000 (20:21 +0200)]
Remove bogus `configure' test for GNU libunistring.

* configure.ac: Remove explicit test for libunistring, which conflicted
  with Gnulib's own test.  This fixes commit
  f4863880f5ef539cb545999c19b6b5c0eec9382d.

14 years agoMisc GOOPS chapter updates
Neil Jerram [Sun, 9 Aug 2009 14:01:59 +0000 (15:01 +0100)]
Misc GOOPS chapter updates

* doc/ref/goops-tutorial.texi: Update intro text.  Fix `an' typo.

* doc/ref/goops.texi: Update quick start intro text.  Simplify
  example that uses `format'.

14 years agoUse #:keyword syntax in preference to :keyword
Neil Jerram [Sun, 9 Aug 2009 13:59:21 +0000 (14:59 +0100)]
Use #:keyword syntax in preference to :keyword

because that is Guile's default.

14 years agoIn general, use @lisp in preference to @smalllisp
Neil Jerram [Sun, 9 Aug 2009 13:54:18 +0000 (14:54 +0100)]
In general, use @lisp in preference to @smalllisp

because it looks better in the DVI output.  Exceptions are

- wide examples, which would cause overfull hboxes if they
  used the bigger @lisp font

- very large examples, which may look too big at the @lisp size.

14 years agoUse @result{} instead of -->
Neil Jerram [Sun, 9 Aug 2009 10:40:01 +0000 (11:40 +0100)]
Use @result{} instead of -->

* doc/ref/goops.texi: Use @result{} instead of -->.

14 years agoUpdate GOOPS Getting Started section
Neil Jerram [Sun, 9 Aug 2009 09:53:14 +0000 (10:53 +0100)]
Update GOOPS Getting Started section

* doc/ref/goops.texi (Getting Started): Renamed `Quick Start', to fit
  better with following Tutorial.  Also add a bit more text to the
  Methods subsection.

14 years agoMinor textual improvements to slot sections
Neil Jerram [Sat, 8 Aug 2009 18:41:10 +0000 (19:41 +0100)]
Minor textual improvements to slot sections

14 years agoMove tutorial sections on slots before inheritance
Neil Jerram [Sat, 8 Aug 2009 18:10:59 +0000 (19:10 +0100)]
Move tutorial sections on slots before inheritance

* doc/ref/goops-tutorial.texi (Instance creation and slot access, Slot
  description): Move to before Inheritance.

14 years agoChange <complex> to <my-complex> in GOOPS tutorial
Neil Jerram [Sat, 8 Aug 2009 18:05:06 +0000 (19:05 +0100)]
Change <complex> to <my-complex> in GOOPS tutorial

* doc/ref/goops-tutorial.texi (Class Definition): Minor text
  improvements.  Change the class being defined to <my-complex>, to
  reduce the confusion with the built in <complex> class.

14 years agoStart updating/merging GOOPS getting started / tutorial text
Neil Jerram [Sat, 8 Aug 2009 15:34:21 +0000 (16:34 +0100)]
Start updating/merging GOOPS getting started / tutorial text

* doc/ref/goops-tutorial.texi (Introduction): Merge this subsection's
  non-duplicate text into the introductory text of the whole section,
  then remove this subsection.

  (Tutorial): Textual updates to introductory text.

  (Class definition and instantiation): Rename `Class definition',
  since that's all it covers.  Remove unnecessary footnote about
  loading (oop goops) module.

  (All @nodes): Remove explicit up, next and prev nodes.  (They make
  the document harder to change.)

* doc/ref/goops.texi (Tutorial): Move from the end of the GOOPS
  chapter to the beginning of it.

  (Running GOOPS): Removed; useful text merged into containing
  section.

14 years agoRemove page break after heading of Chapter 6 (Modules)
Neil Jerram [Sat, 8 Aug 2009 15:26:58 +0000 (16:26 +0100)]
Remove page break after heading of Chapter 6 (Modules)

This brings this chapter into line with the others, which do not have
page breaks before the first section.

14 years agoUse GOOPS Introduction as intorudctory text for the whole GOOPS chapter
Neil Jerram [Sat, 8 Aug 2009 14:55:44 +0000 (15:55 +0100)]
Use GOOPS Introduction as intorudctory text for the whole GOOPS chapter

14 years agoMerge commit 'origin/master'
Michael Gran [Sat, 8 Aug 2009 09:35:08 +0000 (02:35 -0700)]
Merge commit 'origin/master'

14 years agoAdd Unicode strings and symbols
Michael Gran [Sat, 8 Aug 2009 09:35:00 +0000 (02:35 -0700)]
Add Unicode strings and symbols

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

14 years agolambda, the ultimate goto
Andy Wingo [Fri, 7 Aug 2009 17:06:15 +0000 (19:06 +0200)]
lambda, the ultimate goto

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

14 years agoimplement compilation of label-allocated lambda expressions
Andy Wingo [Fri, 7 Aug 2009 15:44:02 +0000 (17:44 +0200)]
implement compilation of label-allocated lambda expressions

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

14 years agoadd label alist to lambda allocations in tree-il->glil compiler
Andy Wingo [Fri, 7 Aug 2009 13:35:53 +0000 (15:35 +0200)]
add label alist to lambda allocations in tree-il->glil compiler

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

14 years agoloop detection in the house
Andy Wingo [Thu, 6 Aug 2009 15:46:38 +0000 (17:46 +0200)]
loop detection in the house

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

14 years agoactually implement "fixing letrec"
Andy Wingo [Thu, 6 Aug 2009 14:01:24 +0000 (16:01 +0200)]
actually implement "fixing letrec"

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

14 years agoactually inline call-with-values to tree-il's <let-values>
Andy Wingo [Thu, 6 Aug 2009 09:48:16 +0000 (11:48 +0200)]
actually inline call-with-values to tree-il's <let-values>

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

14 years agoInclude GOOPS pictures in the distribution
Neil Jerram [Thu, 6 Aug 2009 08:41:32 +0000 (09:41 +0100)]
Include GOOPS pictures in the distribution

14 years agolet-values in terms of syntax-case, add make-tree-il-folder
Andy Wingo [Wed, 5 Aug 2009 19:25:35 +0000 (21:25 +0200)]
let-values in terms of syntax-case, add make-tree-il-folder

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

14 years agoadd <fix> tree-il construct, and compile it
Andy Wingo [Wed, 5 Aug 2009 15:51:40 +0000 (17:51 +0200)]
add <fix> tree-il construct, and compile it

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

14 years agoadd a brain-dead inliner
Andy Wingo [Wed, 5 Aug 2009 14:17:20 +0000 (16:17 +0200)]
add a brain-dead inliner

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

14 years agoadd1 and sub1 instructions
Andy Wingo [Wed, 5 Aug 2009 09:55:42 +0000 (11:55 +0200)]
add1 and sub1 instructions

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

14 years agoperform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS
Andy Wingo [Tue, 4 Aug 2009 19:16:32 +0000 (21:16 +0200)]
perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS

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

14 years agorename configure.in to configure.ac
Andy Wingo [Tue, 4 Aug 2009 18:46:20 +0000 (20:46 +0200)]
rename configure.in to configure.ac

* configure.ac:
* guile-readline/configure.ac: Rename from configure.in, as recommended
  by the autoconf manual.

14 years agofix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+
Andy Wingo [Tue, 4 Aug 2009 18:29:09 +0000 (20:29 +0200)]
fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+

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

14 years agoGit-Ignore effective-version.texi
Neil Jerram [Tue, 4 Aug 2009 11:11:49 +0000 (12:11 +0100)]
Git-Ignore effective-version.texi

14 years agoFix overfull hboxes
Neil Jerram [Tue, 4 Aug 2009 11:10:16 +0000 (12:10 +0100)]
Fix overfull hboxes

14 years agoTypos
Neil Jerram [Tue, 4 Aug 2009 11:08:25 +0000 (12:08 +0100)]
Typos

14 years agoAdd an effective version variable for the manual
Neil Jerram [Tue, 4 Aug 2009 11:08:02 +0000 (12:08 +0100)]
Add an effective version variable for the manual

14 years agoAdd copyright statements to goops.texi and goops-tutorial.texi
Neil Jerram [Tue, 4 Aug 2009 10:49:26 +0000 (11:49 +0100)]
Add copyright statements to goops.texi and goops-tutorial.texi

14 years agoMove GOOPS documentation into the main manual
Neil Jerram [Mon, 3 Aug 2009 19:11:05 +0000 (20:11 +0100)]
Move GOOPS documentation into the main manual

Nothing editorial here, just the minimum to move the GOOPS documentation
into the main manual, and then still have everything build properly.

14 years agoMove `Continuation Barriers' to the section that covers continuations
Neil Jerram [Mon, 3 Aug 2009 12:21:33 +0000 (13:21 +0100)]
Move `Continuation Barriers' to the section that covers continuations

Since continuation barriers protect against non-local exits, it makes
better sense to document them in the same section as continuations and
exceptions.

14 years agoReview/update sections on arbiters and asyncs
Neil Jerram [Mon, 3 Aug 2009 11:04:08 +0000 (12:04 +0100)]
Review/update sections on arbiters and asyncs

14 years agoMiscellaneous small updates
Neil Jerram [Mon, 3 Aug 2009 10:27:51 +0000 (11:27 +0100)]
Miscellaneous small updates

- Typos
- Minor changes to texinfo markup
- Minor wording changes

14 years agoRemove the idea of a separate manual edition number
Neil Jerram [Mon, 3 Aug 2009 10:25:10 +0000 (11:25 +0100)]
Remove the idea of a separate manual edition number

I don't believe this has ever been useful, and I doubt that we've
consistently incremented it in the past.  The reality is that the
manual evolves with the rest of Guile, so Guile's version number
should apply to the manual too.  It is conceivable that we might
one day revise the manual for an existing Guile release, so we keep
a REVISION number to cover that.

14 years agoDon't doubly define scm_t_wchar
Michael Gran [Sat, 1 Aug 2009 18:21:46 +0000 (11:21 -0700)]
Don't doubly define scm_t_wchar

        * libguile/chars.h: don't define scm_t_wchar
        * libguile/numbers.h: define scm_t_wchar here

14 years agoFix coding style compliance for recent 32-bit char changes
Michael Gran [Sat, 1 Aug 2009 18:04:43 +0000 (11:04 -0700)]
Fix coding style compliance for recent 32-bit char changes

        * libguile/print.c (iprin1): extra braces

        * libguile/chars.h (SCM_IS_UNICODE_CHAR): coding style

14 years agoDon't use GNU extensions for SCM_MAKE_CHAR macro
Michael Gran [Sat, 1 Aug 2009 17:15:20 +0000 (10:15 -0700)]
Don't use GNU extensions for SCM_MAKE_CHAR macro

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

14 years agoMake charname declarations module-level and GCS
Michael Gran [Sat, 1 Aug 2009 15:12:15 +0000 (08:12 -0700)]
Make charname declarations module-level and GCS

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

14 years agoUpdate NEWS for charname changes
Michael Gran [Sat, 1 Aug 2009 15:05:55 +0000 (08:05 -0700)]
Update NEWS for charname changes

        * NEWS: updated

14 years agoAdd unused variable analysis in the tree-il->glil compiler.
Ludovic Courtès [Thu, 30 Jul 2009 22:42:58 +0000 (00:42 +0200)]
Add unused variable analysis in the tree-il->glil compiler.

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

14 years agoAdd `(system base message)', a simple warning framework.
Ludovic Courtès [Thu, 30 Jul 2009 22:06:59 +0000 (00:06 +0200)]
Add `(system base message)', a simple warning framework.

* module/Makefile.am (SOURCES): Add `system/base/message.scm'.

* module/scripts/compile.scm (%options): Add `--warn'.
  (parse-args): Update default value for `warnings'.
  (show-warning-help): New procedure.
  (compile)[compile-opts]: Add `#:warnings'.
  Update help message.

* module/system/base/compile.scm (compile): Sanity-check the requested
  warnings.

* module/system/base/message.scm: New file.

14 years agoAdd `tree-il-fold', a purely functional iterator on `tree-il'.
Ludovic Courtès [Wed, 29 Jul 2009 22:48:04 +0000 (00:48 +0200)]
Add `tree-il-fold', a purely functional iterator on `tree-il'.

* module/language/tree-il.scm (tree-il-fold): New procedure.

* test-suite/tests/tree-il.test ("tree-il-fold"): New test prefix.

14 years agoAdd 32-bit characters
Michael Gran [Wed, 29 Jul 2009 13:38:32 +0000 (06:38 -0700)]
Add 32-bit characters

This adds the 32-bit standalone characters.  Strings are still
8-bit.  Characters larger than 8-bit can only be entered or
displayed in octal format at this point.  At this point, the
terminal's display encoding is expected to be Latin-1.

        * module/language/assembly/compile-bytecode.scm (write-bytecode):
        add 32-bit char

        * module/language/assembly.scm (object->assembly): add 32-bit char
        (assembly->object): add 32-bit char

        * libguile/vm-i-system.c (make-char32): new op

        * libguile/print.c (iprin1): print 32-bit char

        * libguile/numbers.h: add type scm_t_wchar

        * libguile/numbers.c: add type scm_t_wchar

        * libguile/chars.h: new type scm_t_wchar
        (SCM_CODEPOINT_MAX): new
        (SCM_IS_UNICODE_CHAR): new
        (SCM_MAKE_CHAR): operate on 32-bit char

        * libguile/chars.c: comparison operators now use Unicode
        codepoints
        (scm_c_upcase): now receives and returns scm_t_wchar
        (scm_c_downcase): now receives and returns scm_t_wchar

14 years agoReplace global charnames variables with accessors
Michael Gran [Tue, 28 Jul 2009 04:02:23 +0000 (21:02 -0700)]
Replace global charnames variables with accessors

The global variables scm_charnames and scm_charnums are replaced with
the accessor functions scm_i_charname and scm_i_charname_to_num.
Also, the incomplete and broken EBCDIC support is removed.

       * libguile/print.c (iprin1): use new func scm_i_charname

        * libguile/read.c (scm_read_character): use new func
        scm_i_charname_to_num

        * libguile/chars.c (scm_i_charname): new function
        (scm_i_charname_to_char): new function
        (scm_charnames, scm_charnums): removed

        * libguile/chars.h: new declarations

14 years agoincrease range of relative jumps by aligning blocks to 8-byte boundaries
Andy Wingo [Sun, 26 Jul 2009 12:01:56 +0000 (14:01 +0200)]
increase range of relative jumps by aligning blocks to 8-byte boundaries

* libguile/objcodes.c (OBJCODE_COOKIE): Bump again, as our jump offsets
  are now multiplied by 8.

* libguile/vm-i-system.c (BR): Interpret the 16-bit offset as a relative
  jump to the nearest 8-byte-aligned block -- increasing relative jump
  range from +/-32K to +/-240K.
  (mvra): Do the same for the mvra jump.

* libguile/vm.c (really_make_boot_program): Align the mvra.

* module/language/assembly.scm (align-block): New export, for aligning
  blocks.

* module/language/assembly/compile-bytecode.scm (write-bytecode): Emit
  jumps to the nearest 8-byte-aligned block. Effectively our range is 18
  bits in either direction. I would like to do this differently -- have
  long-br and long-br-if, and all the other br instructions go to 8 bits
  only. But the assembler doesn't have an appropriate representation to
  allow me to do this yet, so for now this is what we have.

* module/language/assembly/decompile-bytecode.scm (decode-load-program):
  Decode the 19-bit jumps.

14 years agomake sure all programs are 8-byte aligned
Andy Wingo [Sun, 26 Jul 2009 10:56:11 +0000 (12:56 +0200)]
make sure all programs are 8-byte aligned

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

14 years agofix alignment of subprograms of subprograms
Andy Wingo [Sun, 26 Jul 2009 09:54:05 +0000 (11:54 +0200)]
fix alignment of subprograms of subprograms

* module/language/glil/compile-assembly.scm (glil->assembly)
  (dump-object): Fix an exciting bug! Subprograms of subprograms were
  not being aligned correctly, because the code was generated too early.
  So instead delay dumping the object table until the proper time.

14 years agofix unused SCM_FRAME_SET_DYNAMIC_LINK macro
Andy Wingo [Sun, 26 Jul 2009 09:21:18 +0000 (11:21 +0200)]
fix unused SCM_FRAME_SET_DYNAMIC_LINK macro

* libguile/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): Fix for new stack
  layout, though this macro is not used.

14 years agofix vmstack gdb macro for new stack frame layout
Andy Wingo [Sun, 26 Jul 2009 09:20:39 +0000 (11:20 +0200)]
fix vmstack gdb macro for new stack frame layout

* gdbinit (vmstack): No more external link.

14 years agocheck that jumps are within the range of a signed 16-bit int
Andy Wingo [Fri, 24 Jul 2009 10:06:40 +0000 (12:06 +0200)]
check that jumps are within the range of a signed 16-bit int

* module/language/assembly/compile-bytecode.scm (write-bytecode): Check
  that the offset is within the range of a signed int16 value.

14 years agofix gensym creation in psyntax
Andy Wingo [Fri, 24 Jul 2009 10:06:19 +0000 (12:06 +0200)]
fix gensym creation in psyntax

* module/ice-9/psyntax.scm (build-lexical-var): Make our gensyms really
  unique. Before, there was a chance that different lexicals could
  result in the same gensym.
* module/ice-9/psyntax-pp.scm: Regenerate.

14 years agoincrease default stack size to 64 kilowords
Andy Wingo [Fri, 24 Jul 2009 10:05:54 +0000 (12:05 +0200)]
increase default stack size to 64 kilowords

* libguile/vm.c (VM_DEFAULT_STACK_SIZE): Increase to 64 kilowords.
  Really, we should simply add overflow handlers, but in the meantime,
  this will do.

14 years agocompiler support for nlocs >= 256
Andy Wingo [Fri, 24 Jul 2009 09:00:32 +0000 (11:00 +0200)]
compiler support for nlocs >= 256

* libguile/vm-i-system.c (long-local-ref, long-local-set)
  (make-variable): New intructions, for handling nlocs >= 256.
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
  <glil-lexical> with support for nlocs >= 256.

14 years agonlocs is now 16 bits wide
Andy Wingo [Fri, 24 Jul 2009 08:12:01 +0000 (10:12 +0200)]
nlocs is now 16 bits wide

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

14 years agoremove all mentions of "external" from the compiler and related code
Andy Wingo [Thu, 23 Jul 2009 14:50:47 +0000 (16:50 +0200)]
remove all mentions of "external" from the compiler and related code

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.

14 years agorename "closure-ref" to "free-ref"; s/vars/variables/ in some names
Andy Wingo [Thu, 23 Jul 2009 12:36:22 +0000 (14:36 +0200)]
rename "closure-ref" to "free-ref"; s/vars/variables/ in some names

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

14 years agoremove "externals" from the vm
Andy Wingo [Thu, 23 Jul 2009 15:12:10 +0000 (17:12 +0200)]
remove "externals" from the vm

* libguile/frames.c (scm_frame_external_link): Removed.
* libguile/frames.h: No need to have the "external link" in the stack
  frame -- update macros to take the new situation into account.

* libguile/objcodes.h (struct scm_objcode): Rename the nexts field to
  "unused". In the future we can use it for nlocs, I think.
  (SCM_OBJCODE_NEXTS): removed.

* libguile/programs.h:
* libguile/programs.c (scm_make_program): Expect the third argument to
  be a vector of free variables, not a list of free variables.
  SCM_BOOL_F indicates no free variables, not SCM_EOL.
  (program_mark): Adapt.
  (scm_program_arity): No more nexts.
  (scm_program_free_vars): Replaces scm_program_externals.

* libguile/vm-engine.c (VM_CHECK_EXTERNAL)
  (vm_engine): No need for the "external" var.
* libguile/vm-engine.h (CACHE_PROGRAM): Update for SCM_PROGRAM_FREE_VARS
  instead of SCM_PROGRAM_EXTERNALS.
  (NEW_FRAME): Update for new frame size, and no need to cons up
  externals. Yay :)

* libguile/vm-i-loader.c (load-program): Update for scm_make_program.

* libguile/vm-i-system.c (external-ref, external-set): No more.
  (make-closure): No more.
  (goto/args): No need to re-cons externals here. Update for new stack
  frame size.
  (mv-call, return, return/values): Update for new frame size. No need
  to reinstate externals on return.

* libguile/vm.c (really_make_boot_program, scm_load_compiled_with_vm):
  Update for scm_make_program.
* module/language/objcode/spec.scm (objcode-env-externals): Treat '() as
  #f, for the externals. Need to clean this up later...
* module/system/vm/program.scm (arity:nexts): Remove. Rename
  program-external to program-free-vars.

14 years agocompile lexical variable access and closure creation to the new ops
Andy Wingo [Thu, 23 Jul 2009 15:00:56 +0000 (17:00 +0200)]
compile lexical variable access and closure creation to the new ops

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

14 years agovm support for display closures
Andy Wingo [Sun, 19 Jul 2009 17:48:26 +0000 (19:48 +0200)]
vm support for display closures

* libguile/vm-i-system.c (box, empty-box): Boxing values and storing
  them in local variables.
  (local-boxed-ref, local-boxed-set): A combination of local-ref then
  variable-ref/set.
  (make-closure2, closure-ref, closure-boxed-ref, closure-boxed-set):
  New ops. The idea is to migrate Guile over to using flat dispay
  closures. See the paper "Three Implementation Models for Scheme" by
  Kent Dybvig for more details; this is the "stack-based" model.

* libguile/vm-engine.c:
* libguile/vm-engine.h: Add the necessary infrastructure to keep track
  of a "closure" variable, like our "externals" in semantics, but
  minimal, flat, and O(1) in implementation.

14 years agorenumber vm ops (objcode cookie bumped)
Andy Wingo [Sun, 19 Jul 2009 17:02:30 +0000 (19:02 +0200)]
renumber vm ops (objcode cookie bumped)

* libguile/objcodes.c (OBJCODE_COOKIE): Bump.

* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Renumber instructions, so I can have a bit
  more space to work.

14 years agofix (bytevector-ieee-single-native-set! x 0 0)
Andy Wingo [Sat, 18 Jul 2009 17:03:28 +0000 (19:03 +0200)]
fix (bytevector-ieee-single-native-set! x 0 0)

* libguile/bytevectors.c (VALIDATE_REAL): SCM_VALIDATE_REAL is not what
  we need for checking values for bytevector-ieee-single-native-set! et
  al, so define our own validator.
  (IEEE754_SET, IEEE754_NATIVE_SET): Use it.

14 years agobytevectors have "element type" field, e.g. for generalized-vector-ref
Andy Wingo [Sun, 19 Jul 2009 13:11:53 +0000 (15:11 +0200)]
bytevectors have "element type" field, e.g. for generalized-vector-ref

Bytevectors have a very close relationship to other forms of uniform
vectors. Often you want to view a u64vector as a series of bytes, for
writing over a socket; or to process an incoming stream using the
convenient and less error-prone s16vector-ref API rather than
bytevector-s16-native-ref.

The essential needs of the representation of a bytevector and an
s64vector are the same, so we take advantage of that and extend the
bytevector implementation to have a "native type" field, which defaults
to VU8.

This commit doesn't actually expose any user-noticeable changes,
however.

* libguile/bytevectors.h (SCM_BYTEVECTOR_ELEMENT_TYPE): New internal
  defines.
  (scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): New
  internal functions.

* libguile/bytevectors.c (SCM_BYTEVECTOR_SET_ELEMENT_TYPE):
  (SCM_BYTEVECTOR_TYPE_SIZE):
  (SCM_BYTEVECTOR_TYPED_LENGTH): New internal macros.
  (make_bytevector, make_bytevector_from_buffer): Take an extra
  argument, the element type. The length argument is interpreted as
  being the number of elements, which corresponds to the number of bytes
  in the default VU8 case. Doing it this way eliminates a class of bugs
  -- e.g. a u32vector of length 3 bytes doesn't make sense. We do have
  to check for another class of bugs: overflow. The length stored on the
  bytevector itself is still the byte length, though.
  (scm_i_make_typed_bytevector):
  (scm_c_take_typed_bytevector): New internal functions.
  (scm_i_shrink_bytevector): Make sure the new size is valid for the
  bytevector's type.
  (scm_i_bytevector_generalized_set_x): Remove this function, the
  array-handle infrastructure takes care of this for us.
  (print_bytevector): Print the bytevector according to its type.
  (scm_make_bytevector, scm_bytevector_copy)
  (scm_uniform_array_to_bytevector)
  (scm_u8_list_to_bytevector, scm_bytevector_to_uint_list): Adapt to
  make_bytevector extra arg.
  (bv_handle_ref, bv_handle_set_x): Adapt to ref and set based on the
  type of the bytevector, e.g. f64 or u8.
  (bytevector_get_handle): Set the typed length of the vector, not the
  byte length.

Conflicts:

libguile/bytevectors.c

14 years agobytevector inlinedness indicated by flag, not length
Andy Wingo [Sat, 18 Jul 2009 11:46:29 +0000 (13:46 +0200)]
bytevector inlinedness indicated by flag, not length

* libguile/bytevectors.h (SCM_BYTEVECTOR_INLINE_P): Change to check a
  flag instead of checking the length of the bytevector.

* libguile/bytevectors.c (make_bytevector_from_buffer): Handle the len
  <= inline threshold case as well. Set the inline flag as appropriate.
  (make_bytevector): Updat the inline flag as appropriate.
  (scm_c_take_bytevector): Just dispatch to make_bytevector_from_buffer.
  (scm_i_shrink_bytevector): Update the inline flag as appropriate.
  Update the length when shrinking an already-inlined vector.
  (STRING_TO_UTF): Fix some indentation.

14 years agoany->u8vector and family now implemented in Scheme
Andy Wingo [Sat, 18 Jul 2009 11:26:18 +0000 (13:26 +0200)]
any->u8vector and family now implemented in Scheme

* module/Makefile.am:
* module/srfi/srfi-4/gnu.scm: New module, for extensions to srfi-4.
  Currently defines the any->FOOvector family.

* libguile/srfi-4.c:
* libguile/srfi-4.i.c: Dispatch scm_any_to_FOOvector calls to the
  scheme-implemented functions in (srfi srfi-4 gnu).

14 years agomake-typed-array builds backing vector via make-generalized-vector
Andy Wingo [Sat, 18 Jul 2009 10:58:37 +0000 (12:58 +0200)]
make-typed-array builds backing vector via make-generalized-vector

* libguile/arrays.c: Rework to use scm_make_generalized_vector instead
  of our own type table.

* libguile/bitvectors.c: Fix some includes.

14 years agoadd registry of vector constructors, make-generalized-vector
Andy Wingo [Sat, 18 Jul 2009 10:43:54 +0000 (12:43 +0200)]
add registry of vector constructors, make-generalized-vector

* libguile/generalized-vectors.h:
* libguile/generalized-vectors.c: Add a registry of vector constructors.
  (scm_make_generalized_vector): New public function, constructs a
  vector of a given type.

* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/srfi-4.c:
* libguile/strings.c:
* libguile/vectors.c: Register vector constructors.

* libguile/extensions.c (scm_init_extensions): No need to NULL the list
  of registered extensions here, the static init does it for us. Allows
  scm_c_register_extension to be called before scm_init_extensions.

* libguile/init.c (scm_i_init_guile): Move array initialization earlier,
  so e.g. scm_init_strings has access to a valid list of array element
  types when registering its vector constructor.

14 years agouniform vector functions to their own file
Andy Wingo [Sat, 18 Jul 2009 10:18:15 +0000 (12:18 +0200)]
uniform vector functions to their own file

* libguile/uniform.c:
* libguile/uniform.h:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/Makefile.am: Move uniform vector funcs out of srfi-4 to their
  own file.

* libguile.h:
* libguile/arrays.c:
* libguile/bytevectors.c: Update includers.

14 years agogeneric vector ops to own file
Andy Wingo [Fri, 17 Jul 2009 17:05:32 +0000 (19:05 +0200)]
generic vector ops to own file

* libguile/Makefile.am:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h: Move generic vector ops off into their
  own file too. The implementation is now based on the generic
  array-handle infrastructure.

* libguile.h:
* libguile/array-map.c:
* libguile/bitvectors.c:
* libguile/random.c:
* libguile/srfi-4.c: Update includers.

14 years agomove generic array foo out to its own file
Andy Wingo [Fri, 17 Jul 2009 16:54:06 +0000 (18:54 +0200)]
move generic array foo out to its own file

* libguile/arrays.h:
* libguile/arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-arrays.c: Move some generic functionality out of
  arrays.c to a new file.

* libguile/array-map.c:
* libguile/deprecated.c:
* libguile/init.c: Update includers.

14 years agoremove enclosed arrays
Andy Wingo [Fri, 17 Jul 2009 10:45:24 +0000 (12:45 +0200)]
remove enclosed arrays

* libguile/arrays.h:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/deprecated.c: Remove "enclosed arrays". The only user-facing
  procedures that this affects are scm_enclose_array / enclose-array. If
  enclosed arrays are added back, it should be through the generic array
  interface; but really, it sounds like something that would be better
  implemented in Scheme.

14 years agoadd generic array implementation facility
Andy Wingo [Sun, 19 Jul 2009 13:04:40 +0000 (15:04 +0200)]
add generic array implementation facility

* libguile/array-handle.c (scm_i_register_array_implementation):
  (scm_i_array_implementation_for_obj): Add generic array facility,
  which will (in a few commits) detangle the array code.
  (scm_array_get_handle): Use the generic array facility. Note that
  scm_t_array_handle no longer has ref and set function pointers;
  instead it has a pointer to the array implementation. It is unlikely
  that code out there used these functions, however, as the supported
  way was through scm_array_handle_ref/set_x.
  (scm_array_handle_pos): Move this function here from arrays.c.
  (scm_array_handle_element_type): New function, returns a Scheme value
  representing the type of element stored in this array.

* libguile/array-handle.h (scm_t_array_element_type): New enum, for
  generically determining the type of an array.
  (scm_array_handle_rank):
  (scm_array_handle_dims): These are now just #defines.

* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/srfi-4.c:
* libguile/strings.c:
* libguile/vectors.c: Register array implementations for all of these.

* libguile/inline.h: Update for array_handle_ref/set change.
* libguile/deprecated.h: Need to include arrays.h now.

14 years agorename unif.[ch] to arrays.[ch]
Andy Wingo [Thu, 16 Jul 2009 23:08:35 +0000 (01:08 +0200)]
rename unif.[ch] to arrays.[ch]

* libguile/Makefile.am:
* libguile/unif.c:
* libguile/unif.h:
* libguile/arrays.c:
* libguile/arrays.h: Rename unif.[ch] to arrays.[ch].

* libguile.h:
* libguile/array-handle.c:
* libguile/array-map.c:
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/eq.c:
* libguile/gc-card.c:
* libguile/gc-malloc.c:
* libguile/gc-mark.c:
* libguile/gc.c:
* libguile/init.c:
* libguile/inline.h:
* libguile/print.c:
* libguile/random.c:
* libguile/read.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/strports.c:
* libguile/vectors.c:
* libguile/vectors.h: Update includers.

14 years agobitvector exodus from unif.[ch]
Andy Wingo [Thu, 16 Jul 2009 22:58:32 +0000 (00:58 +0200)]
bitvector exodus from unif.[ch]

* libguile/Makefile.am:
* libguile/unif.c:
* libguile/unif.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h: Move bitvector functionality out of unif.[ch].

* libguile/array-handle.c:
* libguile/array-map.c:
* libguile/init.c:
* libguile/read.c:
* libguile/srfi-4.c:
* libguile/vectors.c: Oh, what a tangled web we weave...

14 years agoparts of unif.[ch] to array-handle.[ch]
Andy Wingo [Thu, 16 Jul 2009 22:47:31 +0000 (00:47 +0200)]
parts of unif.[ch] to array-handle.[ch]

* libguile/array-handle.c:
* libguile/array-handle.h: Move some parts of unif.c and unif.h to these
  new files.

* libguile/unif.c:
* libguile/unif.h: Update includers. Since unif.h depends on the array
  handle type, we include array-handle.h, which also means that there
  will be no difference for our callers.

* libguile/init.c: Call scm_init_array_handle, though it does nothing as
  of yet.

* libguile/Makefile.am: Adapt for new files.

14 years agorename ramap.[ch] to array-map.[ch]
Andy Wingo [Thu, 16 Jul 2009 22:25:49 +0000 (00:25 +0200)]
rename ramap.[ch] to array-map.[ch]

* libguile/array-map.c:
* libguile/array-map.h: Rename from ramap.c and ramap.h.

* libguile.h:
* libguile/Makefile.am:
* libguile/eq.c:
* libguile/init.c:
* libguile/sort.c:
* libguile/unif.c:
* libguile/vectors.c: All referrers changed.

14 years agorename scm_i_make_ra to scm_i_make_array
Andy Wingo [Thu, 16 Jul 2009 22:16:43 +0000 (00:16 +0200)]
rename scm_i_make_ra to scm_i_make_array

* libguile/unif.c (scm_i_make_array): Rename from scm_i_make_ra. All
  callers changed.

14 years agoclean up libguile/Makefile.am
Andy Wingo [Thu, 16 Jul 2009 20:15:04 +0000 (22:15 +0200)]
clean up libguile/Makefile.am

* libguile/Makefile.am: Clean up some of the file lists, should make
  future diffs easier to parse.

14 years agoremove convert.{c,i.c,h}
Andy Wingo [Thu, 16 Jul 2009 20:02:25 +0000 (22:02 +0200)]
remove convert.{c,i.c,h}

* libguile/convert.c:
* libguile/convert.h:
* libguile/convert.i.c: Remove these functions, which were undocumented,
  not in the libguile/ header, and thus unlikely to have been used.

14 years agoremove deprecated functions from unif.c
Andy Wingo [Thu, 16 Jul 2009 19:51:47 +0000 (21:51 +0200)]
remove deprecated functions from unif.c

* libguile/unif.h:
* libguile/unif.c: Remove deprecated functions.

* module/ice-9/deprecated.scm: Remove array-related deprecated
  functions.

* NEWS: Update.

14 years agoBump version number for 1.9.1.
Ludovic Courtès [Wed, 15 Jul 2009 21:57:18 +0000 (23:57 +0200)]
Bump version number for 1.9.1.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

14 years agoMake the non-integrated VM test-suite less verbose.
Ludovic Courtès [Wed, 15 Jul 2009 21:56:27 +0000 (23:56 +0200)]
Make the non-integrated VM test-suite less verbose.

* testsuite/run-vm-tests.scm (run-vm-tests): Don't display the number of
  tests passed since it's always 1 or 0.

14 years agoAdd FIXMEs about misaligned objcode-metas.
Ludovic Courtès [Wed, 15 Jul 2009 21:53:22 +0000 (23:53 +0200)]
Add FIXMEs about misaligned objcode-metas.

* libguile/objcodes.c (scm_c_make_objcode_slice): Add comment about
  misaligned `objcode-meta'.

* module/language/assembly/compile-bytecode.scm (write-bytecode):
  Likewise.

14 years agoFix unaligned access in the VM code.
Ludovic Courtès [Wed, 15 Jul 2009 21:51:42 +0000 (23:51 +0200)]
Fix unaligned access in the VM code.

* libguile/vm.c (struct t_32bit_aligned): New.
  (really_make_boot_program)[bytes]: Use it.  This fixes possibly
  unaligned accesses, which cause a "bus error" on some platforms (e.g.,
  sparc-*).

14 years agoConst-qualify buffers passed to `scm_c_make_objcode_slice ()'.
Ludovic Courtès [Wed, 15 Jul 2009 21:12:43 +0000 (23:12 +0200)]
Const-qualify buffers passed to `scm_c_make_objcode_slice ()'.

* libguile/objcodes.c (scm_c_make_objcode_slice): Add `const' qualifier
  for PTR and DATA.

* libguile/objcodes.h: Update accordingly.

14 years agoSwitch remaining GPLv2+ Guile-VM headers to LGPLv3+.
Ludovic Courtès [Wed, 15 Jul 2009 20:46:54 +0000 (22:46 +0200)]
Switch remaining GPLv2+ Guile-VM headers to LGPLv3+.

* module/system/base/compile.scm, module/system/base/syntax.scm,
  module/system/repl/common.scm, module/system/repl/describe.scm,
  module/system/vm/instruction.scm, module/system/vm/objcode.scm,
  module/system/vm/profile.scm, module/system/vm/program.scm,
  module/system/vm/trace.scm: Switch header from GPLv2+ to LGPLv3+.

14 years agoFix typo in the compile-type verification of `OBJCODE_COOKIE'.
Ludovic Courtès [Tue, 14 Jul 2009 23:17:32 +0000 (01:17 +0200)]
Fix typo in the compile-type verification of `OBJCODE_COOKIE'.

* libguile/objcodes.c: Fix `sizeof (OBJCODE_COOKIE)' assertion: the
  trailing 0 must not be taken into account, and multiple of 8 means the
  3 LSBs are clear.

14 years agoMake sure at compile-time that `OBJCODE_COOKIE' has the right size.
Ludovic Courtès [Tue, 14 Jul 2009 23:03:35 +0000 (01:03 +0200)]
Make sure at compile-time that `OBJCODE_COOKIE' has the right size.

* libguile/objcodes.c: Use `verify' to assert that the size of
  `OBJCODE_COOKIE' is a multiple of 8.

14 years agoExplicitly use Gnulib's `verify' module.
Ludovic Courtès [Tue, 14 Jul 2009 22:58:01 +0000 (00:58 +0200)]
Explicitly use Gnulib's `verify' module.

* m4/gnulib-cache.m4: Add `verify'.

14 years agoAugment `OBJCODE_COOKIE' to detect wrong endianness or word size.
Ludovic Courtès [Tue, 14 Jul 2009 22:55:33 +0000 (00:55 +0200)]
Augment `OBJCODE_COOKIE' to detect wrong endianness or word size.

* libguile/objcodes.c (OBJCODE_ENDIANNESS, _OBJCODE_STRINGIFY,
  OBJCODE_STRINGIFY, OBJCODE_WORD_SIZE): New macros.
  (OBJCODE_COOKIE): Use them.  The intent is that `.go' files compiled
  for a different endianness or word size are detected.