bpt/guile.git
11 years agodeprecate lookup closures
Andy Wingo [Wed, 23 May 2012 10:00:23 +0000 (12:00 +0200)]
deprecate lookup closures

* libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE):
* libguile/deprecated.c (scm_lookup_closure_module):
  (scm_module_lookup_closure):
  (scm_current_module_lookup_closure): Deprecate this part of the eval
  closure interface.  It was unused internally, after the scm_sym2var
  refactor.

* libguile/eval.h:
* libguile/modules.c:
* libguile/modules.h: Remove deprecated code.

* libguile/goops.c (scm_ensure_accessor): Use scm_module_variable
  instead of calling the lookup closure.  However I'm not sure that this
  code is used at all.

11 years agodeprecate scm_sym2var
Andy Wingo [Wed, 23 May 2012 09:46:30 +0000 (11:46 +0200)]
deprecate scm_sym2var

* libguile/deprecated.h:
* libguile/deprecated.c (scm_sym2var): Deprecate this function.

* libguile/modules.h:
* libguile/modules.c (scm_module_ensure_local_variable): New public
  function, replacing scm_sym2var with a true definep, without going
  through eval closures (which are deprecated).
  (scm_current_module): Rework to do something sensible before modules
  are booted.
  (scm_module_lookup, scm_lookup): Refactor to use scm_module_variable.
  (scm_module_define, scm_define): Refactor to use
  scm_module_ensure_local_variable.

* libguile/vm-i-system.c (define!): Use scm_define.

* libguile/vm.c (resolve_variable): Use scm_module_lookup.

* libguile/macros.c (scm_make_syntax_transformer): Use
  scm_module_variable.

* libguile/gdbint.c (gdb_binding): Use scm_define.

* doc/ref/api-modules.texi (Accessing Modules from C): Add docs for
  scm_module_ensure_local_variable.

11 years agofix arity check for applicable structs
Andy Wingo [Mon, 21 May 2012 16:06:34 +0000 (18:06 +0200)]
fix arity check for applicable structs

* module/language/tree-il/analyze.scm (validate-arity): Fix for
  applicable structs.  Applicable structs are procedures, but not every
  struct has a first slot, and not every struct with a procedure in its
  first slot is applicable.  Besides, the approach in this patch gives
  better errors.

11 years agorearrange scheme compilation order
Andy Wingo [Mon, 21 May 2012 15:48:45 +0000 (17:48 +0200)]
rearrange scheme compilation order

* module/Makefile.am (SOURCES): Move vlists, srfi-1, peval, and cse up
  in the compilation order.  These are exercised a lot in the compiler.

11 years agovm.c: remove a useless check
Andy Wingo [Mon, 21 May 2012 15:31:58 +0000 (17:31 +0200)]
vm.c: remove a useless check

* libguile/vm.c: Remove a check for modules being booted.  If the module
  passed in is true, that is guaranteed to have been the case.  Passes a
  fresh bootstrap.

11 years agoAdd more `%file-port-name-canonicalization' tests.
Ludovic Courtès [Tue, 15 May 2012 17:12:39 +0000 (19:12 +0200)]
Add more `%file-port-name-canonicalization' tests.

* test-suite/tests/ports.test ("%file-port-name-canonicalization")["relative
  canonicalization with /", "relative canonicalization from ice-9",
  "absolute canonicalization from ice-9"]: New tests.

11 years agoFix relative file name canonicalization with empty %LOAD-PATH entries.
Ludovic Courtès [Tue, 15 May 2012 17:05:37 +0000 (19:05 +0200)]
Fix relative file name canonicalization with empty %LOAD-PATH entries.

* libguile/filesys.c (scm_i_relativize_path): Don't attempt to
  canonicalize when encountering an entry of IN_PATH that is the empty
  string.

* test-suite/tests/ports.test (with-load-path): New macro.
  ("%file-port-name-canonicalization"): New test prefix.

11 years agofix the cse tests
Andy Wingo [Tue, 15 May 2012 15:37:57 +0000 (17:37 +0200)]
fix the cse tests

* test-suite/tests/cse.test (pass-if-cse): Fix-letrec and canonicalize
  the output, so that unreferenced failure continuations get trimmed.
  ("cse"): Fix the two tests regarding bailout info.

11 years agocse passes a lookup procedure to the effects analyzer
Andy Wingo [Tue, 15 May 2012 15:23:06 +0000 (17:23 +0200)]
cse passes a lookup procedure to the effects analyzer

* module/language/tree-il/cse.scm (cse): Arrange to pass a lookup
  procedure to compute-effects, for better effects analysis.

11 years agobetter effects analysis for calls to lexically bound procedures
Andy Wingo [Tue, 15 May 2012 15:22:05 +0000 (17:22 +0200)]
better effects analysis for calls to lexically bound procedures

* module/language/tree-il/effects.scm (make-effects-analyzer): The
  analyzer will take an optional second argument, a lookup procedure of
  type sym -> exp.  This can let the analyzer dig into calls to
  lexically bound procedures.

11 years agofix-letrec tweak
Andy Wingo [Tue, 15 May 2012 15:20:57 +0000 (17:20 +0200)]
fix-letrec tweak

* module/language/tree-il/fix-letrec.scm (make-sequence*, fix-letrec!):
  When turning unreferenced bindings into sequences, don't bother
  emitting trivially constant expressions in effect position.

11 years agoCSE in tail position
Andy Wingo [Tue, 15 May 2012 15:20:01 +0000 (17:20 +0200)]
CSE in tail position

* module/language/tree-il/cse.scm (singly-valued-expression?, cse):
  Allow CSE to propagate lexicals to tail positions, if the expression
  is singly-valued.

11 years agostronger conditional optimization
Andy Wingo [Tue, 15 May 2012 10:21:57 +0000 (12:21 +0200)]
stronger conditional optimization

* module/language/tree-il/peval.scm (peval): If we can lift one common
  test, see if we can lift others as well.

* test-suite/tests/peval.test: Add a test.

11 years agooptimization for chain of if expressions with common tests
Andy Wingo [Tue, 15 May 2012 10:18:30 +0000 (12:18 +0200)]
optimization for chain of if expressions with common tests

* module/language/tree-il/peval.scm (peval): Optimize common tests in
  chains of "if" expressions, like those generated by matchers.

* test-suite/tests/peval.test ("partial evaluation"): Add a test.

11 years agomvoe tree-il=? and tree-il-hash to tree-il.scm
Andy Wingo [Tue, 15 May 2012 10:14:22 +0000 (12:14 +0200)]
mvoe tree-il=? and tree-il-hash to tree-il.scm

* module/language/tree-il.scm (tree-il=?, tree-il-hash): Move these
  helpers here, from cse.scm.  Export them.

* module/language/tree-il/cse.scm (cse): Adapt accordingly.

11 years agoHonor $(program_transform_name) for the `guile-tools' symlink.
Ludovic Courtès [Mon, 14 May 2012 17:21:35 +0000 (19:21 +0200)]
Honor $(program_transform_name) for the `guile-tools' symlink.

Fixes <http://bugs.gnu.org/11451>.
Reported by Cyprien Nicolas <c.nicolas@gmail.com>.

* meta/Makefile.am (install-data-hook): Honor $(program_transform_name).

11 years agoHave `-Wformat' remain quiet for any procedure called `_' or `N_'.
Ludovic Courtès [Sat, 12 May 2012 14:11:51 +0000 (16:11 +0200)]
Have `-Wformat' remain quiet for any procedure called `_' or `N_'.

* module/language/tree-il/analyze.scm (proc-ref?)[special?]: New
  procedure.
  Return #t for any toplevel-ref of `_'.

* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
  format string using gettext as top-level _"): New test.

11 years agoHave `-Warity-mismatch' handle applicable structs.
Ludovic Courtès [Sat, 12 May 2012 13:58:23 +0000 (15:58 +0200)]
Have `-Warity-mismatch' handle applicable structs.

* module/language/tree-il/analyze.scm (arity-analysis): Honor applicable
  structs.

* test-suite/tests/tree-il.test ("warnings")["arity
  mismatch"]("top-level applicable struct", "top-level applicable struct
  with wrong arguments"): New tests.

11 years agoImprove special-casing of `_' in `-Wformat'.
Ludovic Courtès [Sat, 12 May 2012 13:31:28 +0000 (15:31 +0200)]
Improve special-casing of `_' in `-Wformat'.

* module/language/tree-il/analyze.scm (proc-ref?): Check for
  SPECIAL-NAME in the <module-ref> and <lexical-ref> cases too.

* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
  format string using gettext as module-ref _", "non-literal format
  string using gettext as lexical _"): New tests.

11 years agofix more assumptions that the frame-procedure is a procedure
Andy Wingo [Fri, 11 May 2012 12:30:43 +0000 (14:30 +0200)]
fix more assumptions that the frame-procedure is a procedure

* libguile/frames.c (scm_frame_source, scm_frame_previous):
* libguile/stacks.c (scm_make_stack):
* module/ice-9/boot-9.scm (exception-printers):
* module/system/vm/frame.scm (frame-call-representation): Fix more
  assumptions that frame-procedure is a program, or even a procedure.

11 years agoMerge remote-tracking branch 'origin/stable-2.0' into stable-2.0
Andy Wingo [Thu, 10 May 2012 13:55:25 +0000 (15:55 +0200)]
Merge remote-tracking branch 'origin/stable-2.0' into stable-2.0

11 years agorefactor vm application of non-programs; boot continuation refactor
Andy Wingo [Thu, 10 May 2012 10:43:33 +0000 (12:43 +0200)]
refactor vm application of non-programs; boot continuation refactor

* libguile/frames.c (scm_frame_instruction_pointer):
* module/system/vm/frame.scm (frame-bindings):
  (frame-next-source, frame-call-representation): Fix a few locations
  that thought that the frame-procedure will always be a VM
  procedure.  This will not not be the case when traversing the stack of
  an application of a non-procedure.

* libguile/vm-i-system.c (call, tail-call, mv-call): Instead of
  special-casing structs and smobs at these call sites, just set up the
  stack, and jump to a generic apply loop if the proc is not a program.

* libguile/vm-engine.c: The generic apply loop is here.  Also, the boot
  program is now simply a boot continuation, and can handle any number
  of arguments.

* libguile/vm.c (make_boot_program): Update the code that makes the boot
  continuation.

12 years agoAdd missing `SCM_API' for `scm_take_from_input_buffers'.
Ludovic Courtès [Tue, 8 May 2012 10:43:06 +0000 (12:43 +0200)]
Add missing `SCM_API' for `scm_take_from_input_buffers'.

* libguile/ports.h (scm_take_from_input_buffers): Add `SCM_API'.

12 years agoFix `setvbuf' to leave the line/column number unchanged.
Ludovic Courtès [Tue, 8 May 2012 10:43:06 +0000 (12:43 +0200)]
Fix `setvbuf' to leave the line/column number unchanged.

* libguile/fports.c (scm_setvbuf): Use `scm_take_from_input_buffers'
  directly instead of `scm_drain_input'; use `scm_unget_byte' instead of
  `scm_unread_string' to put the drained input back to PORT.  This
  leaves PORT's line/column numbers unchanged, whereas they'd previously
  be decreased by the `scm_unread_string' call.

* libguile/ports.c (scm_take_from_input_buffers): Update description and
  variable names to refer to "bytes", not "chars".

* test-suite/tests/ports.test ("setvbuf"): New test prefix.

12 years agodocbook->texi fix
Andy Wingo [Tue, 8 May 2012 14:03:54 +0000 (16:03 +0200)]
docbook->texi fix

* module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Only convert
  ulink to uref if there is a URL attribute.

12 years ago(texinfo docbook) support for @acronym
Andy Wingo [Mon, 7 May 2012 18:39:14 +0000 (20:39 +0200)]
(texinfo docbook) support for @acronym

* module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Recognize
  "acronym" as parsing to the @acronym texinfo command.

12 years agoadd support for texinfo parsed arguments, like @acronym
Andy Wingo [Mon, 7 May 2012 18:18:56 +0000 (20:18 +0200)]
add support for texinfo parsed arguments, like @acronym

* module/texinfo.scm (texi-command-specs): Add a new kind of texinfo
  command, inline-text-args, a sort of a cross between inline-args,
  which are unparsed, and inline-text, which is.  Perhaps this should
  supersede inline-args at some point.  In any case, add acronym as an
  inline-text-args element.
  (inline-content?, arguments->attlist, complete-start-command)
  (parse-inline-text-args, make-dom-parser): Adapt for
  inline-text-args.

* module/texinfo/serialize.scm (inline-text-args): Add serialization for
  @acronym.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add some
  tests.

12 years agoAdd a missing SYNC_ALL in variable-ref
Andy Wingo [Wed, 2 May 2012 10:59:11 +0000 (12:59 +0200)]
Add a missing SYNC_ALL in variable-ref

* libguile/vm-i-system.c (variable-ref): Add a missing SYNC_ALL.

12 years agoOptimize `scm_read_string'.
Ludovic Courtès [Sun, 6 May 2012 22:32:01 +0000 (00:32 +0200)]
Optimize `scm_read_string'.

According to the new benchmarks, this leads a 5% speed improvement when
reading small strings, and a 27% improvement when reading large strings.

* libguile/read.c (READER_STRING_BUFFER_SIZE): Change to 128; update
  comment to mention codepoints.
  (scm_read_string): Make `str' a list of strings, instead of a string.
  Store characters read in buffer `c_str'.  Cons to STR when C_STR is
  full, and concatenate/reverse at the end.

* benchmark-suite/benchmarks/read.bm (small, large): New variables.
  Set %DEFAULT-PORT-ENCODING to "UTF-8".
  ("read")["small strings", "large strings"]: New benchmarks.

12 years agoMake `scm_unget_byte' public.
Ludovic Courtès [Sun, 6 May 2012 20:24:47 +0000 (22:24 +0200)]
Make `scm_unget_byte' public.

* libguile/ports.h (scm_unget_byte): Make `SCM_API' instead of
  `SCM_INTERNAL'.

12 years agoread: Avoid `void *' pointer arithmetic.
Ludovic Courtès [Sun, 6 May 2012 20:23:58 +0000 (22:23 +0200)]
read: Avoid `void *' pointer arithmetic.

* libguile/read.c (read_complete_token): Make `new_buf' a `char *' to
  avoid pointer arithmetic on `void *'.

12 years agoBuild with `-Wpointer-arith' when available.
Ludovic Courtès [Sun, 6 May 2012 20:23:12 +0000 (22:23 +0200)]
Build with `-Wpointer-arith' when available.

* configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wpointer-arith'.

12 years agoCorrect typing of assertion in the `wind' instruction.
Ludovic Courtès [Fri, 4 May 2012 22:44:54 +0000 (00:44 +0200)]
Correct typing of assertion in the `wind' instruction.

* libguile/vm-i-system.c (wind): Check `scm_to_bool (scm_thunk_p (x))'
  instead of `scm_thunk_p'.

12 years agoSimplify the reader's `read_complete_token'.
Ludovic Courtès [Fri, 4 May 2012 20:36:27 +0000 (22:36 +0200)]
Simplify the reader's `read_complete_token'.

* libguile/read.c (read_token): Remove unneeded `const' before `size_t'.
  (read_complete_token): Remove `overflow_buffer' parameter; return
  `char *' instead of `int'.  Allocate the overflow buffer with
  `scm_gc_malloc_pointerless' instead of `scm_malloc'.  Return either
  the overflow buffer or BUFFER.
  (scm_read_number, scm_read_mixed_case_symbol,
  scm_read_number_and_radix): Rename `buffer' to `local_buffer', and
  `overflow_buffer' to `buffer'.  Remove `overflow'.  Adjust code to new
  `read_complete_token'.

12 years agopush error handlers out of line in the vm
Andy Wingo [Mon, 30 Apr 2012 18:25:53 +0000 (20:25 +0200)]
push error handlers out of line in the vm

* libguile/vm.c:
  (vm_error):
  (vm_error_bad_instruction):
  (vm_error_unbound):
  (vm_error_unbound_fluid):
  (vm_error_not_a_variable):
  (vm_error_not_a_thunk):
  (vm_error_apply_to_non_list):
  (vm_error_kwargs_length_not_even):
  (vm_error_kwargs_invalid_keyword):
  (vm_error_kwargs_unrecognized_keyword):
  (vm_error_too_many_args):
  (vm_error_wrong_num_args):
  (vm_error_wrong_type_apply):
  (vm_error_stack_overflow):
  (vm_error_stack_underflow):
  (vm_error_improper_list):
  (vm_error_not_a_pair):
  (vm_error_not_a_bytevector):
  (vm_error_not_a_struct):
  (vm_error_no_values):
  (vm_error_not_enough_values):
  (vm_error_continuation_not_rewindable):
  (vm_error_bad_wide_string_length):
  (vm_error_invalid_address):
  (vm_error_object):
  (vm_error_free_variable): New internal helpers, implementing VM error
  handling.

* libguile/vm-engine.h (VM_ASSERT): New helper macro.
  (ASSERT, CHECK_OBJECT, CHECK_FREE_VARIABLE):
  (PRE_CHECK_UNDERFLOW, PUSH_LIST): Use the new helper.

* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Use VM_ASSERT and the out-of-line error
  handlers.

* libguile/vm-engine.c (vm_engine): Remove inline error handlers, and
  remove a couple of local vars.  Use VM_ASSERT.  Have halt handle the
  return itself.

12 years agoadd internal SCM_NOINLINE definition
Andy Wingo [Mon, 30 Apr 2012 17:51:06 +0000 (19:51 +0200)]
add internal SCM_NOINLINE definition

* libguile/_scm.h (SCM_NOINLINE): New internal define, for things that
  we definitely don't want the compiler to inline.

12 years agoadd scm_c_values helper
Andy Wingo [Mon, 30 Apr 2012 17:40:52 +0000 (19:40 +0200)]
add scm_c_values helper

* libguile/values.h:
* libguile/values.c (scm_c_values): New public helper.

12 years agovlist performance improvements; allocate vhash data inline
Andy Wingo [Mon, 23 Apr 2012 19:42:40 +0000 (21:42 +0200)]
vlist performance improvements; allocate vhash data inline

* module/ice-9/vlist.scm (make-block): If we are making a hash table,
  allocate it inline with the contents.  Otherwise don't even add a
  pointer to the block.
  (block-hash-table?): New internal accessor.
  (block-ref*): Remove.  Vhash entries are no longer wrapped.
  (block-ref):
  (block-hash-table-next-offset):
  (block-hash-table-set-next-offset!):
  (block-hash-table-ref):
  (block-hash-table-set!):
  (block-hash-table-add!): Adapt to take content vector explicitly, and
  to expect the hash table inline with the contents.  Some of these
  accessors are new.  Adapt callers.
  (assert-vlist): New helper.
  (vlist-cons): Update comment.
  (vhash?): Update scheme to allocate the hash table and chain links
  inline with the contents.
  (%vhash-fold*, %vhash-assoc): Rewrite to be more performant.

12 years agoavoid emitting degenerate aliases in peval
Andy Wingo [Mon, 23 Apr 2012 15:56:28 +0000 (17:56 +0200)]
avoid emitting degenerate aliases in peval

* module/language/tree-il/peval.scm (<operand>, make-operand)
  (make-bound-operands, peval): Avoid emitting needless aliases in
  degenerate cases of let.
  (visit-operand): If we visit an operand with a fresh counter and have
  to abort, record that fact.

* test-suite/tests/peval.test ("partial evaluation"): Add a test.

12 years agovlist-cons micro-optimizations
Andy Wingo [Mon, 23 Apr 2012 11:07:34 +0000 (13:07 +0200)]
vlist-cons micro-optimizations

* module/ice-9/vlist.scm (set-block-next-free!): Define this instead of
  increment-block-next-free!.
  (block-append!): Refactor to take an offset, and only append if the
  offset is the next free value, and there is space in the block.
  (block-cons): Refactor to not be a loop.  The partial evaluator would
  have to understand effects analysis in order to be able to unroll it,
  and there's at most one recursion.

  Recovers the performance loss resulting from the previous commit.

12 years agoslight vlist refactor
Andy Wingo [Mon, 23 Apr 2012 09:43:01 +0000 (11:43 +0200)]
slight vlist refactor

* module/ice-9/vlist.scm: Use define-inlinable instead of define-inline,
  to ensure strict argument evaluation.  There is a slight performance
  penalty, but I hope subsequent hacks make it up.

12 years agofix replacement of CSE with lexical-ref
Andy Wingo [Mon, 16 Apr 2012 23:25:19 +0000 (16:25 -0700)]
fix replacement of CSE with lexical-ref

* module/language/tree-il/cse.scm (cse): Fix dominator unrolling for
  lexical propagation.

* test-suite/tests/cse.test ("cse"): Add test.

12 years agocse hashing tweak
Andy Wingo [Mon, 16 Apr 2012 19:42:31 +0000 (12:42 -0700)]
cse hashing tweak

* module/language/tree-il/cse.scm (cse): Minor tweak to hash depth based
  on time profile of compiling peval.scm.

12 years agomore inlining in effects.scm
Andy Wingo [Sun, 15 Apr 2012 20:41:05 +0000 (13:41 -0700)]
more inlining in effects.scm

* module/language/tree-il/effects.scm (define-effects)
  (&no-effects, &all-effects-but-bailout):
  (cause, &depends-on, &causes, depends-on-effects?)
  (causes-effects?, effects-commute?): Add ham-fisted inlining.

12 years agobetter primitives support for bit operations
Andy Wingo [Sun, 15 Apr 2012 20:39:56 +0000 (13:39 -0700)]
better primitives support for bit operations

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Add lognot.
  (*effect-free-primitives*): Add ash, logand, logior, logxor, and
  lognot.
  (logior, logand): Define associative expanders.

12 years agodisable optimizations in goops dispatch procedures
Andy Wingo [Sun, 15 Apr 2012 20:00:30 +0000 (13:00 -0700)]
disable optimizations in goops dispatch procedures

* module/oop/goops/dispatch.scm: Disable peval and cse.

12 years agoenable cse
Andy Wingo [Fri, 13 Apr 2012 22:23:20 +0000 (15:23 -0700)]
enable cse

* module/language/tree-il/optimize.scm: Enable CSE unless #:cse? #f is
  passed.

* test-suite/tests/tree-il.test: Disable CSE for one test.

12 years agonew pass: cse
Andy Wingo [Fri, 13 Apr 2012 22:23:15 +0000 (15:23 -0700)]
new pass: cse

* module/language/tree-il/cse.scm: New pass, some simple common
  subexpression elimination with effects analysis.

* test-suite/tests/cse.test: New test.

* test-suite/Makefile.am:
* module/Makefile.am: Adapt.

12 years agominor tweaks to a peval test
Andy Wingo [Fri, 13 Apr 2012 22:13:19 +0000 (15:13 -0700)]
minor tweaks to a peval test

* test-suite/tests/peval.test: Update mutable var test to really ensure
  that the function can't inline.

12 years agopeval uses effects analysis
Andy Wingo [Thu, 12 Apr 2012 23:46:18 +0000 (16:46 -0700)]
peval uses effects analysis

* module/language/tree-il/peval.scm: Use effects analysis from (language
  tree-il effects) instead of our own constant-expression?.  Eagerly
  mark assigned lexicals as non-copyable.

12 years agoadd effects
Andy Wingo [Thu, 12 Apr 2012 23:25:45 +0000 (16:25 -0700)]
add effects

* module/language/tree-il/effects.scm: New module, for effects
  analysis.
* module/Makefile.am: Adapt.

12 years agopeval tests into separate file
Andy Wingo [Wed, 11 Apr 2012 18:43:00 +0000 (11:43 -0700)]
peval tests into separate file

* test-suite/tests/tree-il.test ("partial evaluation"):
* test-suite/tests/peval.test ("partial evaluation"): Separate peval
* tests.

* test-suite/Makefile.am: Adapt.

12 years agoadd more primitives and predicates to (language tree-il primitives)
Andy Wingo [Tue, 10 Apr 2012 22:47:21 +0000 (15:47 -0700)]
add more primitives and predicates to (language tree-il primitives)

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Add number? and char?.  Add more
  numeric predicates.  Add character comparators.  Add throw, error, and
  scm-error.
  (*primitive-accessors*): Remove struct-vtable.  Though the vtable's
  contents may change (through redefinition), its identity does not
  change.
  (*effect-free-primitives*): Put struct-vtable, number?, and char?
  here.
  (*multiply-valued-primitives*): Instead of listing singly-valued
  primitives, list multiply-valued primitives.
  (*bailout-primitives*): New list.
  (*negatable-primitives*): New alist.
  (*bailout-primitive-table*, *multiply-valued-primitive-table*)
  (*negatable-primitive-table*): New tables.
  (singly-valued-primitive?): Adapt to
  use *multiply-valued-primitive-table*.
  (bailout-primitive?, negate-primitive): New exported procedures.

12 years agomodernize (benchmark-suite lib)
Andy Wingo [Mon, 23 Apr 2012 08:42:09 +0000 (04:42 -0400)]
modernize (benchmark-suite lib)

* benchmark-suite/benchmark-suite/lib.scm: Rewrite to be more modern,
  using parameters, records, and higher precision timers.  Since this
  file was never installed, this is an acceptable interface change.
  (run-benchmark): Run the thunk once before going into the benchmark.
  Adapt to new `report' interface.
  (report): Change to expect only one argument, a <benchmark-result>
  object.
  (print-result): Adapt.  The result is in the same format as before.
  (print-user-result): Adapt.  The result is different from before, but
  as this is just printed on stdout and not logged, there should be no
  problem.
  (calibrate-benchmark-framework): Pull initialization into a function.

12 years agoavoid inexact iteration count in benchmarks
Andy Wingo [Mon, 23 Apr 2012 08:27:34 +0000 (04:27 -0400)]
avoid inexact iteration count in benchmarks

* benchmark-suite/benchmarks/arithmetic.bm:
* benchmark-suite/benchmarks/r6rs-arithmetic.bm: Use #e1e7 for the
  iteration count, instead of the flonum 1e7.

12 years agomove (test-suite lib) to lower dir; cleans up uninstalled paths.
Andy Wingo [Sat, 21 Apr 2012 21:06:48 +0000 (17:06 -0400)]
move (test-suite lib) to lower dir; cleans up uninstalled paths.

* check-guile.in:
* test-suite/Makefile.am:
* test-suite/test-suite/lib.scm:

* benchmark-guile.in:
* benchmark-suite/Makefile.am:
* benchmark-suite/benchmark-suite/lib.scm: Lower the lib modules in the
  source tree.  This lets us remove top_srcdir and top_builddir from the
  uninstalled paths.

* test-suite/tests/asm-to-bytecode.test:
* test-suite/tests/brainfuck.test:
* test-suite/tests/compiler.test:
* test-suite/tests/ftw.test:
* test-suite/tests/gc.test:
* test-suite/tests/match.test:
* test-suite/tests/rnrs-libraries.test:
* test-suite/tests/rnrs-test-a.scm:
* test-suite/tests/sxml.match.test: Adapt to not expect that module
  names be prefixed with "test-suite".

12 years agoThank Klaus.
Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
Thank Klaus.

12 years agobytevectors: Fix IEEE-754 endianness conversion.
Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
bytevectors: Fix IEEE-754 endianness conversion.

Fixes <http://bugs.gnu.org/11310>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* libguile/ieee-754.h: Remove.
* libguile/Makefile.am (noinst_HEADERS): Remove `ieee-754.h'.

* libguile/bytevectors.c (scm_ieee754_float, scm_ieee754_double): New
  unions.
  (float_to_foreign_endianness, float_from_foreign_endianness,
  double_to_foreign_endianness, double_from_foreign_endianness): Rewrite
  in terms of the new unions.

* test-suite/tests/bytevectors.test ("2.8 Operations on IEEE-754
  Representations")["single, little endian", "single, big endian",
  "double, little endian", "double, big endian"]: New tests.

12 years agoFix and clarify documentation of `sorted?'.
Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
Fix and clarify documentation of `sorted?'.

Fixed <http://bugs.gnu.org/11262>.
Reported by Alexei Matveev <alexei.matveev@gmail.com>.

* libguile/sort.c (scm_sorted_p): Fix and clarify docstring.
* doc/ref/api-utility.texi (Sorting): Update accordingly.

12 years agoRemove duplicate test in `tree-il.test'.
Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
Remove duplicate test in `tree-il.test'.

* test-suite/tests/tree-il.test ("partial evaluation"): Remove duplicate
  test for `(cons 0 (cons 1 (cons 2 (list 3 4 5))))'.

12 years agoAvoid use of `GC_PTR' in "smob.h".
Ludovic Courtès [Thu, 12 Apr 2012 21:16:48 +0000 (23:16 +0200)]
Avoid use of `GC_PTR' in "smob.h".

Commit c46fee438cf9f4a3449e8d04e7a54805517fd092 removed the "bdw-gc.h"
include from "smob.h", so better avoid `GC_PTR'.

* libguile/smob.c (scm_i_finalize_smob): Use `void *' instead of `GC_PTR'.
* libguile/smob.h (scm_i_finalize_smob): Update declaration accordingly.

12 years agoSRFI-9: Set the `record-constructor' slot of the RTD.
Ludovic Courtès [Mon, 9 Apr 2012 22:17:39 +0000 (00:17 +0200)]
SRFI-9: Set the `record-constructor' slot of the RTD.

Fixed <http://bugs.gnu.org/11196>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* module/srfi/srfi-9.scm (define-record-type): Define the contructor
  before TYPE-NAME.  Set RTD's constructor field.

* test-suite/tests/srfi-9.test ("record compatibility"): New test
  prefix.

12 years agoFix scm_to_utf8_stringn once and for all; optimize; add tests
Mark H Weaver [Wed, 4 Apr 2012 22:58:44 +0000 (18:58 -0400)]
Fix scm_to_utf8_stringn once and for all; optimize; add tests

* libguile/strings.c (scm_to_utf8_stringn): Fix another new bug in this
  recent comedy of errors: pass the size of the preallocated buffer to
  u32_to_u8.  Arrange to call 'scm_i_string_wide_chars' and
  'scm_i_string_length' only once each.  Rename local variables for
  improved code clarity.

* test-suite/standalone/test-conversion.c (test_to_utf8_stringn): New
  function to test scm_to_utf8_stringn.

12 years agoFix scm_to_utf8_stringn to NUL-terminate properly
Mark H Weaver [Tue, 3 Apr 2012 13:50:20 +0000 (09:50 -0400)]
Fix scm_to_utf8_stringn to NUL-terminate properly

* libguile/strings.c (scm_to_utf8_stringn): NUL-terminate using the
  correct pointer.

12 years agoFix scm_to_utf8_stringn to return the length in bytes, et al
Mark H Weaver [Mon, 2 Apr 2012 22:55:45 +0000 (18:55 -0400)]
Fix scm_to_utf8_stringn to return the length in bytes, et al

* libguile/strings.c (u32_u8_length_in_bytes): Internal static function
  renamed from u32_u8_strlen, whose name was potentially confusing.  For
  added safety, handle everything that can be encoded in the more
  general UTF-8 encoding: up to six bytes for each code point, with code
  points up to 2^31-1.

  (scm_to_utf8_stringn): NUL-terminate only if (lenp == NULL).
  If (lenp != NULL) return the length in bytes in *lenp.

12 years agofix scm_to_utf8_stringn for wide strings to NUL-append the strings
Andy Wingo [Sun, 1 Apr 2012 18:29:41 +0000 (11:29 -0700)]
fix scm_to_utf8_stringn for wide strings to NUL-append the strings

* libguile/strings.c (u32_u8_strlen, scm_to_utf8_stringn): Sigh, fix the
  u32-to-u8 optimization to ensure that the utf8 string is
  NUL-terminated.

12 years agoprimitive resolution for public refs
BT Templeton [Sat, 10 Mar 2012 08:31:58 +0000 (03:31 -0500)]
primitive resolution for public refs

* module/language/tree-il/primitives.scm (resolve-primitives!): Resolve
  public module-refs to primitives.

* test-suite/tests/tree-il.test: New tests for primitive resolution.

12 years agoadd bad-request printer
Andy Wingo [Sun, 11 Mar 2012 09:57:05 +0000 (10:57 +0100)]
add bad-request printer

* module/web/request.scm (bad-request-printer): Add printer for these
  exceptions.

12 years agoadd exception printers for bad-header, bad-header-component
Andy Wingo [Sun, 11 Mar 2012 09:24:08 +0000 (10:24 +0100)]
add exception printers for bad-header, bad-header-component

* module/web/http.scm (bad-header-component): Throw
  'bad-header-component instead of 'bad-header.
  (bad-header-printer, bad-header-component-printer): Add exception
  printers.

12 years agomicro-optimizations to string-trim-both, and to (web http)
Andy Wingo [Wed, 7 Mar 2012 11:39:30 +0000 (12:39 +0100)]
micro-optimizations to string-trim-both, and to (web http)

* libguile/srfi-13.c (scm_string_trim, scm_string_trim_right)
  (scm_string_trim_both): Take the whitespace fast-path if the char_pred
  is scm_char_set_whitespace.

* module/web/http.scm (read-header, split-and-trim, parse-quality-list):
  (parse-param-component, parse-credentials, "Content-Type"):
  (read-request-line, read-response-line): Use char-set:whitespace
  instead of char-whitespace?.  It avoids recursing into the VM.

12 years agomake applicable smob calls cheaper, and fix a memory leak
Andy Wingo [Sun, 18 Mar 2012 19:04:28 +0000 (20:04 +0100)]
make applicable smob calls cheaper, and fix a memory leak

* libguile/vm.c (prepare_smob_call): New helper.  Now, instead of making
  a per-smob trampoline, we will shuffle the smob into the args and use
  a gsubr.  This prevents a memory leak in which the trampolines, which
  were values in a weak-key table, were preventing the smobs from being
  collected.

* libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob
  application mechanism.
  (smob-call): Remove this instruction.

* libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode
  to apply_trampoline.

* libguile/smob.c: Remove our own objcode trampolines in favor of using
  scm_c_make_gsubr.
  (scm_smob_prehistory): No more trampoline weak map.

* libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob
  representation change.

12 years agoweb http: fix Ma -> Mar
Andy Wingo [Mon, 12 Mar 2012 15:58:15 +0000 (16:58 +0100)]
web http: fix Ma -> Mar

* module/web/http.scm (write-date): Fix serialization of Mar.  Oops.

12 years agoweb server http: 400 Bad Request on bad requests
Andy Wingo [Sun, 11 Mar 2012 09:29:06 +0000 (10:29 +0100)]
web server http: 400 Bad Request on bad requests

* module/web/server/http.scm (bad-request, http-read): If an exception
  is raised while reading a response, write out a 400 Bad Request
  response before closing the port.

12 years agomore libgc 7.1 compat
Andy Wingo [Thu, 8 Mar 2012 22:50:41 +0000 (23:50 +0100)]
more libgc 7.1 compat

* configure.ac:
* libguile/gc.c (GC_set_finalize_on_demand): Check for this function,
  and shim if it isn't present.

12 years agorun finalizers asynchronously in asyncs
Andy Wingo [Fri, 24 Feb 2012 12:18:48 +0000 (13:18 +0100)]
run finalizers asynchronously in asyncs

* libguile/finalizers.c: New excitement!  We'll be running finalizers
  asynchronously, from asyncs.  This will make it safer to allocate
  while holding a mutex.
  (GC_set_finalizer_notifier): Add back-compat shim.

* libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism
  during boot.

* libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing
  on demand.
  (scm_gc): Explicitly run finalizers here.

* libguile/threads.c (guilify_self_2): Run finalizers here if
  queue_finalizer_async happened to run during guilify_self_1.

* configure.ac: Add check for GC_set_finalizer_notifier.

12 years agouse the new finalizer helpers
Andy Wingo [Sun, 19 Feb 2012 11:23:29 +0000 (12:23 +0100)]
use the new finalizer helpers

* libguile/foreign.c (scm_set_pointer_finalizer_x)
* libguile/ports.c (finalize_port)
* libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob)
* libguile/struct.c (scm_i_alloc_struct)
* libguile/numbers.c (make_bignum): Use the new API.

12 years agoadd scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator
Andy Wingo [Sun, 19 Feb 2012 11:22:12 +0000 (12:22 +0100)]
add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator

* libguile/finalizers.h:
* libguile/finalizers.c: New files.

* libguile.h:
* libguile/Makefile.am: Add to build.

12 years agoscm_new_smob, scm_new_double_smob inline functions
Andy Wingo [Thu, 26 May 2011 14:49:47 +0000 (16:49 +0200)]
scm_new_smob, scm_new_double_smob inline functions

* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
  which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
  functions instead of macros.  They also bail to scm_i_new_smob /
  scm_i_new_double_smob in either the mark or the free case, so that the
  inline definition doesn't reference other internal details like libgc
  stuff.
  (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
  them as already being declared.
  (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
  (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
  inline functions.

  Remove now-unneeded bdw-gc include.

* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
  make static.
  (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.
  (scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add
  back-compatibility shims to preserve ABI.

* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
  scm_new_double_smob.

12 years agoscm_cell, scm_double_cell, scm_words back to gc.h
Andy Wingo [Thu, 26 May 2011 14:08:02 +0000 (16:08 +0200)]
scm_cell, scm_double_cell, scm_words back to gc.h

* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
  declarations and definitions back here, from inline.h.  It's more
  natural.

* libguile/inline.c: Include gc.h as well.

12 years agosimplify inline function infrastructure
Andy Wingo [Thu, 26 May 2011 13:53:02 +0000 (15:53 +0200)]
simplify inline function infrastructure

* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
  from inline.h.  We'd like to support inline function definitions in
  more header files: not just inline.h.
  (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
  definitions.

* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
  wrappers, which redirect to the GC_MALLOC macros when building Guile,
  and the scm_gc_malloc functions otherwise.  A step towards getting
  BDW-GC out of Guile's API.

* libguile/inline.h: Simplify, using SCM_INLINE,
  SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES.  Also use the
  new SCM_GC_MALLOC macros.

12 years agoFix flush on soft ports, so that it actually runs.
Ian Price [Fri, 27 Jan 2012 06:38:09 +0000 (06:38 +0000)]
Fix flush on soft ports, so that it actually runs.

* libguile/vports.c (sf_flush): Remove conditional testing the
  position in the port's write_buf, as it is no longer used.

12 years agoImprove port benchmark.
Ludovic Courtès [Wed, 7 Mar 2012 20:57:58 +0000 (21:57 +0100)]
Improve port benchmark.

* benchmark-suite/benchmarks/ports.bm (sequence): New macro, formerly
  local to the "rdelim" benchmark prefix.
  (large-string): New procedure.
  (%latin1-port, %utf8/ascii-port, %utf8/wide-port): Use it.
  ("peek-char", "char-ready?", "read-char"): Use `sequence'.

12 years agoFix a segfault when /dev/urandom is not accessible
Giuseppe Scrivano [Tue, 21 Feb 2012 14:55:44 +0000 (15:55 +0100)]
Fix a segfault when /dev/urandom is not accessible

* libguile/init.c (scm_i_init_guile): Call `scm_init_random' before
`scm_init_macros'.

12 years agodeprecate close-io-port
Andy Wingo [Mon, 5 Mar 2012 22:52:00 +0000 (23:52 +0100)]
deprecate close-io-port

* module/ice-9/r4rs.scm:
* module/ice-9/deprecated.scm (close-io-port): Deprecate.

12 years agoDon't call SYMBOL_STRINGBUF on a string
Mark H Weaver [Mon, 5 Mar 2012 03:47:04 +0000 (22:47 -0500)]
Don't call SYMBOL_STRINGBUF on a string

* libguile/strings.c (scm_i_make_symbol): Use STRING_STRINGBUF
  instead of SYMBOL_STRINGBUF to get the stringbuf of a string.

12 years agoRemove documentation of internal static string comparison functions
Mark H Weaver [Mon, 5 Mar 2012 03:12:48 +0000 (22:12 -0500)]
Remove documentation of internal static string comparison functions

* doc/ref/api-data.texi (String Comparison): Remove documentation for
  scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only
  internal functions but static, and thus unusable by external code.

12 years agoComment out unused definitions of 'do' and 'case' in psyntax.scm
Mark H Weaver [Sun, 4 Mar 2012 17:01:10 +0000 (12:01 -0500)]
Comment out unused definitions of 'do' and 'case' in psyntax.scm

* module/ice-9/psyntax.scm (do, case): Comment out these definitions,
  which are never used and immediately replaced by definitions in
  boot-9.scm.

* module/ice-9/psyntax-pp.scm: Regenerate.

12 years agoFix syntax wrap comments; remove old unused cruft
Mark H Weaver [Sun, 4 Mar 2012 16:53:23 +0000 (11:53 -0500)]
Fix syntax wrap comments; remove old unused cruft

* module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new,
  rename-marks, make-rename): Remove these unused syntax rules.
  Fix description of syntax wraps to match current reality.

12 years agoMinimize size of embedded syntax objects in psyntax-pp.scm
Mark H Weaver [Fri, 2 Mar 2012 23:40:43 +0000 (18:40 -0500)]
Minimize size of embedded syntax objects in psyntax-pp.scm

* module/ice-9/compile-psyntax.scm: Minimize syntax object literals
  embedded in psyntax-pp.scm.

* module/ice-9/psyntax.scm: Rename a few variables so that syntax
  objects embedded in macros have no lexical bindings, so that their
  minimized syntax objects will have no embedded labels.  These labels
  were the last remaining gensym counters in psyntax-pp.scm.

* module/ice-9/psyntax-pp.scm: Regenerate.  It is now less than one
  quarter of its previous size!  More importantly, this file no longer
  contains any gensym counters, which means that in the future, local
  changes to psyntax.scm will usually result in only local changes to
  psyntax-pp.scm.

12 years agotree-il->scheme improvements
Mark H Weaver [Thu, 1 Mar 2012 22:56:14 +0000 (17:56 -0500)]
tree-il->scheme improvements

* module/language/tree-il.scm (tree-il->scheme): New implementation that
  simply calls 'decompile-tree-il'.

* module/language/scheme/decompile-tree-il.scm (choose-output-names,
  do-decompile): New internal procedures.

  (decompile-tree-il): New and improved implementation.  Print source
  identifiers where possible, otherwise add minimal numeric suffixes.
  Previously we printed the gensyms.  Avoid 'begin' in contexts that
  provide an implicit 'begin'.  Produce 'cond', 'case', 'and', 'or',
  'let*', named let, and internal defines where appropriate.  Recognize
  keyword arguments in 'opts' to disable the production of these derived
  syntactic forms, and to optionally strip numeric suffixes from
  variable names.

* module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec
  fixing, and primitive expansion when producing psyntax-pp.scm, in
  order to produce output as close to the original source as practical.
  Disable production of derived syntactic forms as needed during
  bootstrap.  Strip numeric suffixes from variable names.  Adjust
  pretty-printing parameters.

* module/ice-9/psyntax-pp.scm: Regenerate.  It is now less than half
  of the original size.

12 years agopretty-print: allow max-expr-width to be set; recognize more keywords
Mark H Weaver [Sun, 26 Feb 2012 20:58:30 +0000 (15:58 -0500)]
pretty-print: allow max-expr-width to be set; recognize more keywords

* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument
  '#:max-expr-width'.

  (generic-write): Add new argument 'max-expr-width'.  Previously this
  was internally defined to the constant value 50.

12 years agoFix typos in psyntax.scm
Mark H Weaver [Fri, 2 Mar 2012 22:54:23 +0000 (17:54 -0500)]
Fix typos in psyntax.scm

* module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat
  (define*): #'x --> #'id

* module/ice-9/psyntax-pp.scm: Regenerate

12 years agotweaks to -Wformat's gettext detection
Andy Wingo [Fri, 2 Mar 2012 16:46:28 +0000 (17:46 +0100)]
tweaks to -Wformat's gettext detection

* module/language/tree-il/analyze.scm (proc-ref?): Change to use less
  false-if-exception and more variable-bound?.  If a variable is present
  in the local module but not bound, assume that it is gettext if it has
  the right name.  This is to allow for (define _ gettext).

* test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.

12 years agopeval: inline applications of lambda to rest args
Andy Wingo [Fri, 2 Mar 2012 14:51:05 +0000 (15:51 +0100)]
peval: inline applications of lambda to rest args

* module/language/tree-il/peval.scm (peval): Add optimization to
  hoist the inner procedure out of e.g.
    (lambda args (apply (lambda ...) args))
  This commit restores the ability to detect escape-only prompts at
  compile-time.

* test-suite/tests/tree-il.test: Update test for prompt with a lambda,
  and add a specific test for lambda application.

12 years agotree-il: fix `canonicalize!' for prompts
Andy Wingo [Fri, 2 Mar 2012 15:39:56 +0000 (16:39 +0100)]
tree-il: fix `canonicalize!' for prompts

* module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in
  which the sense of `escape-only?' was reversed.  We never saw this
  though, because for other reasons, no prompts were being identified as
  escape-only.

12 years agomore general treatment of call-with-prompt
Andy Wingo [Fri, 2 Mar 2012 12:02:19 +0000 (13:02 +0100)]
more general treatment of call-with-prompt

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Don't limit the call-with-prompt to <prompt> transition to lambda
  expressions.  Instead we can lexically bind the handler, and rely on
  peval to propagate a lambda expression.

12 years agopmatch: always wrap with let, even if the expression appears atomic
Mark H Weaver [Sun, 26 Feb 2012 20:53:11 +0000 (15:53 -0500)]
pmatch: always wrap with let, even if the expression appears atomic

* module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even
  if the expression appears atomic, because in the presence of
  'identifier-syntax', we cannot know what an atomic expression will
  later expand to.  Also use '#:export-syntax' instead of '#:export'
  to export 'pmatch'.

12 years agoFix <TAG>vector-length when applied to other uniform vector types
Mark H Weaver [Thu, 1 Mar 2012 21:07:28 +0000 (16:07 -0500)]
Fix <TAG>vector-length when applied to other uniform vector types

* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm
  (define-bytevector-type): Fix definition of <TAG>vector-length when
  applied to uniform vectors of different element sizes.  Thanks to
  Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug.

* test-suite/tests/srfi-4.test: Add tests.

12 years agoAvoid failure when `format-analysis' stumbles upon unbound variables.
Ludovic Courtès [Sun, 26 Feb 2012 23:51:09 +0000 (00:51 +0100)]
Avoid failure when `format-analysis' stumbles upon unbound variables.

* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref'
  in `false-if-exception'.

* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
  format string with forward declaration"): New test.

12 years agosrfi-18 test fix
Andy Wingo [Fri, 24 Feb 2012 19:01:47 +0000 (20:01 +0100)]
srfi-18 test fix

* test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of
  an and.  Before, they were not being run, for some reason I don't
  fully understand.