bpt/guile.git
10 years agoAdd effects analysis pass on CPS
Andy Wingo [Sat, 7 Dec 2013 18:58:08 +0000 (19:58 +0100)]
Add effects analysis pass on CPS

* module/Makefile.am:
* module/language/cps/effects-analysis.scm: New helper module.

10 years agoFix prim -> VM op mapping for u8/s8 bytevector ops
Andy Wingo [Sat, 7 Dec 2013 18:41:59 +0000 (19:41 +0100)]
Fix prim -> VM op mapping for u8/s8 bytevector ops

* module/language/cps/primitives.scm (*instruction-aliases*): Fix
  aliases for bytevector u8 / s8 operations.

* module/language/cps/compile-bytecode.scm (compile-fun): Fix s8
  operations.

10 years agoMerge branch 'stable-2.0'
Mark H Weaver [Thu, 9 Jan 2014 06:32:32 +0000 (01:32 -0500)]
Merge branch 'stable-2.0'

Conflicts:
module/system/vm/traps.scm
test-suite/tests/peval.test

10 years agoFix trap handlers to handle applicable structs.
Ian Price [Thu, 24 Oct 2013 04:51:47 +0000 (05:51 +0100)]
Fix trap handlers to handle applicable structs.

Reported by Jordy Dickinson <jordy.dickinson@gmail.com>.
Fixes <http://bugs.gnu.org/15691>.

* module/system/vm/traps.scm (frame-matcher): Extract procedure when
  proc is an applicable struct.

10 years agoFix 'string-copy!' to work properly with overlapping src/dest.
Mark H Weaver [Wed, 25 Dec 2013 10:10:19 +0000 (05:10 -0500)]
Fix 'string-copy!' to work properly with overlapping src/dest.

* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with
  overlapping src/dest.

* test-suite/tests/srfi-13.test ("string-copy!"): Add tests.

10 years agoImplement 'exact-integer?' and 'scm_is_exact_integer'.
Mark H Weaver [Fri, 20 Dec 2013 23:12:37 +0000 (18:12 -0500)]
Implement 'exact-integer?' and 'scm_is_exact_integer'.

* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
  New procedures.
  (scm_integer_p): Improve docstring.

* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
  New prototypes.

* doc/ref/api-data.texi (Integers): Add docs.

* test-suite/tests/numbers.test ("exact-integer?"): Add tests.

10 years agoFix doc that incorrectly claimed (integer? +inf.0) => #t.
Mark H Weaver [Thu, 9 Jan 2014 02:39:55 +0000 (21:39 -0500)]
Fix doc that incorrectly claimed (integer? +inf.0) => #t.

Fixes <http://bugs.gnu.org/16356>.
Reported by Zefram <zefram@fysh.org>.

* doc/ref/api-data.texi (Integers): Add docs.  Fix outdated example
  that incorrectly showed (integer? +inf.0) => #t.

10 years agoscm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
Mark H Weaver [Tue, 24 Dec 2013 11:48:44 +0000 (06:48 -0500)]
scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.

* libguile/load.c (scm_primitive_load): Use
  'scm_open_file_with_encoding'.

10 years agoboot-9: add comment about autoload thread-unsafety.
Mark H Weaver [Tue, 24 Dec 2013 12:40:40 +0000 (07:40 -0500)]
boot-9: add comment about autoload thread-unsafety.

* module/ice-9/boot-9.scm: Add comment about lack of thread-safety in
  handling of autoloads.

10 years agoread: Avoid signed integer overflow in 'read_decimal_integer'.
Mark H Weaver [Tue, 24 Dec 2013 13:00:51 +0000 (08:00 -0500)]
read: Avoid signed integer overflow in 'read_decimal_integer'.

* libguile/read.c (read_decimal_integer): Avoid overflow.

10 years agoIncrement SCM_N_READ_OPTIONS for 'curly-infix' option.
Mark H Weaver [Tue, 24 Dec 2013 19:39:44 +0000 (14:39 -0500)]
Increment SCM_N_READ_OPTIONS for 'curly-infix' option.

* libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8.
  This should have been done when the 'curly-infix' was added.

10 years agoFix inlining of tail list to apply.
Ian Price [Wed, 23 Oct 2013 10:14:26 +0000 (11:14 +0100)]
Fix inlining of tail list to apply.

Fixes <http://bugs.gnu.org/15533>.

* module/language/tree-il/peval.scm (peval): Final list argument to
  `apply' should not be inlined if it is mutable.
* test-suite/tests/peval.test ("partial evaluation"): Add test.

10 years agoThank Aleix.
Ludovic Courtès [Sat, 21 Dec 2013 21:01:38 +0000 (22:01 +0100)]
Thank Aleix.

10 years agoallow specifying a required version in GUILE_PROGS
Aleix Conchillo Flaque [Thu, 3 Oct 2013 22:49:07 +0000 (15:49 -0700)]
allow specifying a required version in GUILE_PROGS

* meta/guile.m4: GUILE_PROGS now takes an optional argument to specify a
  required Guile version. By default, it requires Guile >= 2.0. A micro
  version can also be specified (e.g. GUILE_PROGS([2.0.10])).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
10 years agoRevert "Fix bound-identifier=? to compare binding names, not just symbolic names."
Mark H Weaver [Tue, 17 Dec 2013 03:55:25 +0000 (22:55 -0500)]
Revert "Fix bound-identifier=? to compare binding names, not just symbolic names."

This reverts commit 70c74b847680d3b239e591afa2e99c51a712980c.

10 years agoFix bound-identifier=? to compare binding names, not just symbolic names.
Mark H Weaver [Mon, 16 Dec 2013 00:04:59 +0000 (19:04 -0500)]
Fix bound-identifier=? to compare binding names, not just symbolic names.

Fixes <http://bugs.gnu.org/16158>.

* module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare
  binding names (gensyms), not just symbolic names.

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

* test-suite/tests/syntax.test: Add test.

10 years agoHide EINTR returns from 'accept'.
Ludovic Courtès [Sun, 15 Dec 2013 21:48:41 +0000 (22:48 +0100)]
Hide EINTR returns from 'accept'.

* libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'.

10 years agosyntax-case: fix error reporting for misplaced ellipses.
Mark H Weaver [Fri, 13 Dec 2013 17:53:24 +0000 (12:53 -0500)]
syntax-case: fix error reporting for misplaced ellipses.

Reported by taylanbayirli@gmail.com (Taylan Ulrich B.).

* module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure
  the pattern tail, instead of 'pair?', 'car', and 'cdr'.
  (gen-clause): When checking for errors, check for misplaced ellipsis
  before duplicate pattern variables, to improve the error message in
  case of multiple misplaced ellipses.

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

* test-suite/tests/syntax.test: Add tests.

10 years agoTHANKS Tom Tromey.
Mark H Weaver [Fri, 13 Dec 2013 05:34:40 +0000 (00:34 -0500)]
THANKS Tom Tromey.

* THANKS: Add Tom Tromey to fixes section.

10 years agoMerge branch 'stable-2.0'
Mark H Weaver [Fri, 13 Dec 2013 04:44:46 +0000 (23:44 -0500)]
Merge branch 'stable-2.0'

Conflicts:
libguile/pairs.c
libguile/vm.c
test-suite/tests/control.test

10 years agoRemove unused function scm_i_tag_name.
Tom Tromey [Tue, 10 Dec 2013 14:43:33 +0000 (07:43 -0700)]
Remove unused function scm_i_tag_name.

* libguile/gc.c (scm_i_tag_name): Remove.

10 years agoAdd missing FUNC_NAME defines for pair accessors.
Tom Tromey [Tue, 10 Dec 2013 14:43:35 +0000 (07:43 -0700)]
Add missing FUNC_NAME defines for pair accessors.

* libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar,
  scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar,
  scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar,
  scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr,
  scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar,
  scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines.

10 years agoFix computation of LIBLOBJS.
Tom Tromey [Tue, 10 Dec 2013 14:43:34 +0000 (07:43 -0700)]
Fix computation of LIBLOBJS.

Fixes <http://bugs.gnu.org/14193>.

* configure.ac (LIBLOBJS): Add prefix to computed .lo file name so
  dependencies work properly.

10 years agoFix section table writing for non-loadable sections
Andy Wingo [Tue, 10 Dec 2013 19:03:59 +0000 (20:03 +0100)]
Fix section table writing for non-loadable sections

* module/system/vm/linker.scm (add-elf-objects): Don't fill in the
  sh_addr field if the section is not loadable.

10 years agoQuick documentation fixes.
Andy Wingo [Tue, 10 Dec 2013 18:53:55 +0000 (19:53 +0100)]
Quick documentation fixes.

* doc/ref/compiler.texi: Make it build.

10 years agoNon-loadable sections should not have an sh_addr field set
Andy Wingo [Tue, 10 Dec 2013 18:49:24 +0000 (19:49 +0100)]
Non-loadable sections should not have an sh_addr field set

* module/system/vm/linker.scm (relocate-section-header):
  (write-linker-object): Sections that are not loadable should not have
  their sh_addr fields set.  Fix.

10 years agoBeginnings of CPS section in manual
Andy Wingo [Sat, 7 Dec 2013 18:59:39 +0000 (19:59 +0100)]
Beginnings of CPS section in manual

* doc/ref/compiler.texi (Continuation-Passing Style): Beginnings of this
  section.  Will be finished when we fix implicit truncation.

10 years agoFix cross-references in api-macros.texi
Andy Wingo [Sat, 7 Dec 2013 18:58:43 +0000 (19:58 +0100)]
Fix cross-references in api-macros.texi

* doc/ref/api-macros.texi (Macro Expansion): Fix cross-references.

10 years agoArities-fixing pass handles incoming $ktrunc with rest args
Andy Wingo [Fri, 6 Dec 2013 11:04:10 +0000 (12:04 +0100)]
Arities-fixing pass handles incoming $ktrunc with rest args

* module/language/cps/arities.scm (fix-clause-arities): Allow $ktrunc
  arities with rest arguments.

10 years agoElide values primcalls with continuations with rest arguments
Andy Wingo [Fri, 6 Dec 2013 10:39:04 +0000 (11:39 +0100)]
Elide values primcalls with continuations with rest arguments

* module/language/cps/elide-values.scm (elide-values): Elide values
  primcalls when continuation has rest arguments.

10 years ago(call-with-values foo (lambda (a . b) a)) avoids consing rest list
Andy Wingo [Fri, 6 Dec 2013 10:08:45 +0000 (11:08 +0100)]
(call-with-values foo (lambda (a . b) a)) avoids consing rest list

* module/language/cps/slot-allocation.scm (allocate-slots): Don't
  allocate slots to unused results of function calls.  This can allow us
  to avoid consing a rest list for call-with-values with an ignored rest
  parameter, and can improve the parallel move code.

* module/language/cps/compile-bytecode.scm (compile-fun): Adapt to avoid
  emitting bind-rest in values context if the rest arg is unused.

10 years agovm: Gracefully handle stack overflows.
Ludovic Courtès [Thu, 5 Dec 2013 21:18:02 +0000 (22:18 +0100)]
vm: Gracefully handle stack overflows.

Fixes <http://lists.gnu.org/archive/html/guile-user/2013-12/msg00017.html>.
Reported by rvclayton@verizon.net (R. Clayton).

* libguile/vm.c (reinstate_stack_reserve): New function.
  (vm_error_stack_overflow): Install it as an unwind handler.
* test-suite/tests/control.test ("the-vm")["stack overflow reinstates
  stack reserve"]: New test.

10 years agocompiler.texi tweaks
Andy Wingo [Thu, 5 Dec 2013 10:55:10 +0000 (11:55 +0100)]
compiler.texi tweaks

* doc/ref/compiler.texi (Compiler Tower): Reword a couple things.
  (Tree-IL): Add more vertical space, for readability in info.

10 years agoDoc updates to macroexpansion, compiled procs, and compiler.texi
Andy Wingo [Wed, 4 Dec 2013 19:46:02 +0000 (20:46 +0100)]
Doc updates to macroexpansion, compiled procs, and compiler.texi

* doc/ref/api-macros.texi (Macro Expansion): New section.
* doc/ref/api-procedures.texi (Compiled Procedures): Beginnings of a
  revision.  Not finished.
* doc/ref/compiler.texi (Compiling to the Virtual Machine): Beginnings
  of a revision.  CPS and bytecode are not done yet.

10 years agoRename "RTL" to "bytecode"
Andy Wingo [Mon, 2 Dec 2013 20:31:47 +0000 (21:31 +0100)]
Rename "RTL" to "bytecode"

"RTL" didn't make any sense, and now that there's no other bytecode to
disambiguate against, just call it bytecode.

* module/Makefile.am:
* module/ice-9/eval-string.scm:
* module/language/bytecode.scm:
* module/language/bytecode/spec.scm:
* module/language/cps/arities.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/compile-rtl.scm:
* module/language/cps/contification.scm:
* module/language/cps/elide-values.scm:
* module/language/cps/primitives.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/spec.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/rtl.scm:
* module/language/rtl/spec.scm:
* module/scripts/compile.scm:
* module/system/base/compile.scm:
* module/system/repl/common.scm:
* module/system/vm/assembler.scm:
* module/system/vm/debug.scm:
* module/system/vm/disassembler.scm:
* module/system/vm/dwarf.scm:
* test-suite/tests/cross-compilation.test:
* test-suite/tests/dwarf.test:
* test-suite/tests/rtl-compilation.test:
* test-suite/tests/rtl.test:
* test-suite/vm/run-vm-tests.scm: Fixups.

10 years agoFix brainfuck comment
Andy Wingo [Mon, 2 Dec 2013 18:02:05 +0000 (19:02 +0100)]
Fix brainfuck comment

* module/language/brainfuck/parse.scm: Fix outdated comment.

10 years agoFix brainfuck->scheme compiler.
Andy Wingo [Mon, 2 Dec 2013 18:00:57 +0000 (19:00 +0100)]
Fix brainfuck->scheme compiler.

* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix
  brainfuck compiler.

10 years agoFix brainfuck comment
Andy Wingo [Mon, 2 Dec 2013 18:02:05 +0000 (19:02 +0100)]
Fix brainfuck comment

* module/language/brainfuck/parse.scm: Fix outdated comment.

10 years agoFix brainfuck->scheme compiler.
Andy Wingo [Mon, 2 Dec 2013 18:00:57 +0000 (19:00 +0100)]
Fix brainfuck->scheme compiler.

* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix
  brainfuck compiler.

10 years agoGOOPS doc fix: #:dsupers is the init keyword for the dsupers slot.
Mark H Weaver [Sun, 1 Dec 2013 23:35:37 +0000 (18:35 -0500)]
GOOPS doc fix: #:dsupers is the init keyword for the dsupers slot.

* doc/ref/goops.texi (Metaclasses): #:dsupers is the initialization
  keyword for the dsupers slot, not #:supers.

10 years agoThread safe port properties.
Mark H Weaver [Sun, 1 Dec 2013 23:29:33 +0000 (18:29 -0500)]
Thread safe port properties.

* libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x):
  Lock the port mutex while accessing the port alist.

* libguile/read.c (set_port_read_option): Lock the port mutex
  while modifying port read options.

10 years agoAdd section to vm.texi about Guile's use of ELF
Andy Wingo [Sun, 1 Dec 2013 11:35:12 +0000 (12:35 +0100)]
Add section to vm.texi about Guile's use of ELF

* doc/ref/vm.texi (Object File Format): New section.

10 years agovm.texi tweak
Andy Wingo [Sat, 30 Nov 2013 19:59:14 +0000 (20:59 +0100)]
vm.texi tweak

* doc/ref/vm.texi (Why a VM?): Small tense tweak.

10 years agoUpdate vm.texi's "Instruction Set" section.
Andy Wingo [Sat, 30 Nov 2013 17:45:55 +0000 (18:45 +0100)]
Update vm.texi's "Instruction Set" section.

* doc/ref/vm.texi (Instruction Set): Update.

10 years agoFix more vm-engine comments
Andy Wingo [Sat, 30 Nov 2013 17:00:26 +0000 (18:00 +0100)]
Fix more vm-engine comments

* libguile/vm-engine.c: Fix more comments.

10 years agoRemove slot-ref and slot-set! ops
Andy Wingo [Sat, 30 Nov 2013 15:43:28 +0000 (16:43 +0100)]
Remove slot-ref and slot-set! ops

* libguile/vm-engine.c: Remove slot-ref and slot-set! ops.

10 years agoRemove GOOPS-internal @slot-ref and @slot-set!
Andy Wingo [Sat, 30 Nov 2013 15:40:17 +0000 (16:40 +0100)]
Remove GOOPS-internal @slot-ref and @slot-set!

* module/oop/goops.scm: Remove definitions of @slot-ref and @slot-set!.
  They are equivalent to struct-ref and struct-set!.
  (define-standard-accessor-method): Reimplement using syntax-case.
  (bound-check-get, standard-get, standard-set): Replace @slot-ref and
  @slot-set! uses with struct-ref and struct-set!.

* module/language/cps/reify-primitives.scm (primitive-module): Remove
  @slot-set! and @slot-ref references.

10 years agoBeginning vm.texi updates
Andy Wingo [Fri, 29 Nov 2013 22:24:17 +0000 (23:24 +0100)]
Beginning vm.texi updates

* doc/ref/vm.texi: Updates.

10 years agoFix vm-engine.c comments
Andy Wingo [Fri, 29 Nov 2013 22:23:28 +0000 (23:23 +0100)]
Fix vm-engine.c comments

* libguile/vm-engine.c: Fix some comments.

10 years agoUnknown files print as (unknown file) in disassembler
Andy Wingo [Fri, 29 Nov 2013 16:59:00 +0000 (17:59 +0100)]
Unknown files print as (unknown file) in disassembler

* module/system/vm/disassembler.scm (disassemble-buffer): Print unknown
  files as "(unknown file)".

10 years ago,x disassembles nested programs too
Andy Wingo [Fri, 29 Nov 2013 16:52:11 +0000 (17:52 +0100)]
,x disassembles nested programs too

* module/system/vm/disassembler.scm (code-annotation):
  (disassemble-buffer, disassemble-addr, disassemble-program): Arrange
  to disassemble nested procedures.
  (disassemble-image): Adapt.

10 years agoUpdate history.texi
Andy Wingo [Fri, 29 Nov 2013 11:29:12 +0000 (12:29 +0100)]
Update history.texi

* doc/ref/history.texi (A Timeline of Selected Guile Releases, Status):
  Update.

10 years agoRemove outdated section of api-memory.texi
Andy Wingo [Fri, 29 Nov 2013 11:28:53 +0000 (12:28 +0100)]
Remove outdated section of api-memory.texi

* doc/ref/api-memory.texi (Memory Blocks): Remove section documenting
  scm_must_malloc and friends.

10 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Thu, 28 Nov 2013 15:24:38 +0000 (16:24 +0100)]
Merge remote-tracking branch 'origin/stable-2.0'

10 years agoCritical sections in guardians do not need to block asyncs
Andy Wingo [Thu, 28 Nov 2013 15:20:42 +0000 (16:20 +0100)]
Critical sections in guardians do not need to block asyncs

* libguile/guardians.c: Critical sections here cannot cause an
  async_tick, so they do not need to block asyncs.

10 years agoMerge commit 'd364a8971828e38e8f9112b711066f4962bb400e'
Andy Wingo [Thu, 28 Nov 2013 15:16:48 +0000 (16:16 +0100)]
Merge commit 'd364a8971828e38e8f9112b711066f4962bb400e'

Conflicts:
libguile/deprecated.h
libguile/gc.c

10 years agoMerge commit 'e7bd20f7d9b2110fdc0fa25db5a2bfe6b2214923'
Andy Wingo [Thu, 28 Nov 2013 15:15:55 +0000 (16:15 +0100)]
Merge commit 'e7bd20f7d9b2110fdc0fa25db5a2bfe6b2214923'

10 years agoMerge commit '17330398d50524058c2ef488bd21ac5ec9c8b6e8'
Andy Wingo [Thu, 28 Nov 2013 15:15:51 +0000 (16:15 +0100)]
Merge commit '17330398d50524058c2ef488bd21ac5ec9c8b6e8'

10 years agoMerge commit 'a38024baaa32d1a6d91fdc81388c88bbb926c3ae'
Andy Wingo [Thu, 28 Nov 2013 15:15:38 +0000 (16:15 +0100)]
Merge commit 'a38024baaa32d1a6d91fdc81388c88bbb926c3ae'

Conflicts:
libguile/ports.h

10 years agoMerge commit '2437c7b2e8b4ab7786847ee1ce0b59e446a70fe2'
Andy Wingo [Thu, 28 Nov 2013 15:03:58 +0000 (16:03 +0100)]
Merge commit '2437c7b2e8b4ab7786847ee1ce0b59e446a70fe2'

Conflicts:
libguile/guardians.c

10 years agoMerge commit '8571dbde639e0ee9885bad49c9e180474bd23646'
Andy Wingo [Thu, 28 Nov 2013 14:00:17 +0000 (15:00 +0100)]
Merge commit '8571dbde639e0ee9885bad49c9e180474bd23646'

Conflicts:
libguile/procprop.c

10 years agoMerge commit '750ac8c592e792e627444f476877f282525b132e'
Andy Wingo [Thu, 28 Nov 2013 13:53:03 +0000 (14:53 +0100)]
Merge commit '750ac8c592e792e627444f476877f282525b132e'

Conflicts:
.gitignore
libguile/deprecated.c

10 years agoMerge commit 'c61be45084d04b1db792b7e232f5bd77099f3287'
Andy Wingo [Thu, 28 Nov 2013 13:47:38 +0000 (14:47 +0100)]
Merge commit 'c61be45084d04b1db792b7e232f5bd77099f3287'

Conflicts:
libguile/ports.c

10 years agoMerge commit 'd360671c1cca335600079f1c5714572d1c2e676d'
Andy Wingo [Thu, 28 Nov 2013 13:46:24 +0000 (14:46 +0100)]
Merge commit 'd360671c1cca335600079f1c5714572d1c2e676d'

10 years agoDeprecate gc-live-object-stats
Andy Wingo [Thu, 28 Nov 2013 13:40:58 +0000 (14:40 +0100)]
Deprecate gc-live-object-stats

* libguile/gc.h:
* libguile/gc.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't
  worked in the whole 2.0 series.

10 years agoAvoid needless GC on startup due to scm_gc_register_allocation
Andy Wingo [Thu, 28 Nov 2013 11:10:50 +0000 (12:10 +0100)]
Avoid needless GC on startup due to scm_gc_register_allocation

* libguile/gc.c (bytes_until_gc): Initialize to
  DEFAULT_INITIAL_HEAP_SIZE, to avoid forced GC on the first
  mallocation.

10 years agoRemove private-gc.h
Andy Wingo [Thu, 28 Nov 2013 10:53:57 +0000 (11:53 +0100)]
Remove private-gc.h

* libguile/simpos.c (scm_getenv_int): Move here, from gc.c.

* libguile/private-gc.h: Remove, unused.

* libguile/simpos.h: Move scm_getenv_int declaration here.

* libguile/vm.c:
* libguile/gc.c: Adapt scm_getenv_int users.

* libguile/gc-malloc.c:
* libguile/load.c:
* libguile/script.c: Remove private-gc includes from non-users of
  scm_getenv_int.

* libguile/Makefile.am: Adapt.

10 years agoscm_i_tag_name internal to gc.c
Andy Wingo [Thu, 28 Nov 2013 10:46:13 +0000 (11:46 +0100)]
scm_i_tag_name internal to gc.c

* libguile/gc.c (scm_i_tag_name): Make internal to gc.c.

* libguile/private-gc.h: Remove from here.

10 years agoMore private-gc excisions
Andy Wingo [Thu, 28 Nov 2013 10:43:51 +0000 (11:43 +0100)]
More private-gc excisions

* libguile/private-gc.h (SCM_DOUBLECELL_ALIGNED_P): Remove; unused.
* libguile/filesys.c (MAX, MIN): Move definitions here, from
  private-gc.h.
  (scm_sendfile, scm_readdir): Adapt uses of SCM_MAX and SCM_MIN to use
  MAX or MIN.

10 years agoRemove unused enum policy_on_error
Andy Wingo [Thu, 28 Nov 2013 10:37:29 +0000 (11:37 +0100)]
Remove unused enum policy_on_error

* libguile/private-gc.h (enum policy_on_error): Remove unused enum.

10 years agoTune initial heap size
Andy Wingo [Thu, 28 Nov 2013 10:32:08 +0000 (11:32 +0100)]
Tune initial heap size

* libguile/fluids.c (new_fluid): Don't run an explicit GC for the first
  fluid.

* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE, scm_storage_prehistory):
  Enlarge from 32 kB to 512 or 1024 kB, depending on word size.  Reduces
  startup time by 10 or 15% by avoiding excessive
  GC.

* libguile/private-gc.h: Remove SCM_DEFAULT_INIT_HEAP_SIZE_2 definition
  here.

10 years agoRemove another GC 6.8 hack
Andy Wingo [Thu, 28 Nov 2013 10:05:38 +0000 (11:05 +0100)]
Remove another GC 6.8 hack

* libguile/gc.c (scm_storage_prehistory): Remove hack for BDW-GC 6.8.

10 years agoFix "include" doc typo
Andy Wingo [Thu, 28 Nov 2013 09:59:42 +0000 (10:59 +0100)]
Fix "include" doc typo

* doc/ref/api-evaluation.texi (Local Inclusion): Fix typo.

10 years agoUse version 2.2 in manual examples
Andy Wingo [Thu, 28 Nov 2013 09:57:42 +0000 (10:57 +0100)]
Use version 2.2 in manual examples

* doc/ref/api-evaluation.texi (Load Paths):
* doc/ref/api-options.texi (Build Config):
* doc/ref/guile-invoke.texi (Environment Variables):
* doc/ref/libguile-parallel.texi (Parallel Installations): Use 2.2 in
  examples, rather than 2.0.

10 years agoFix some references to objcode in the manual
Andy Wingo [Thu, 28 Nov 2013 09:56:55 +0000 (10:56 +0100)]
Fix some references to objcode in the manual

* doc/ref/api-evaluation.texi (Compilation): Update references from
  "objcode" to "rtl".

10 years agoRemove nonfunctional gdb interface
Andy Wingo [Wed, 27 Nov 2013 21:30:15 +0000 (22:30 +0100)]
Remove nonfunctional gdb interface

* libguile/gdb_interface.h:
* libguile/gdbint.c:
* libguile/gdbint.h: Remove.  These were last modified significantly in
  1997 and I think they are unused.

* libguile/guile.c: Remove use.
* libguile.h: Remove inclusion.
* libguile/Makefile.am: Remove reference.
* libguile/init.c: Remove use.

10 years agoRemove the restore-continuation-hook.
Andy Wingo [Wed, 27 Nov 2013 21:03:58 +0000 (22:03 +0100)]
Remove the restore-continuation-hook.

* libguile/vm.h:
* libguile/vm.c:
* libguile/vm-engine.c:
* module/system/vm/traps.scm:
* module/system/vm/vm.scm: Remove the unused and redundant
  restore-continuation-hook.

10 years agoDeclare r6rs-ports functions
Andy Wingo [Wed, 27 Nov 2013 20:13:20 +0000 (21:13 +0100)]
Declare r6rs-ports functions

* libguile/r6rs-ports.h:
* libguile/r6rs-ports.c: Declare scm_unget_bytevector and
  scm_i_make_transcoded_port.

10 years agoFix uninitialized variable error in some peek-char error cases
Andy Wingo [Wed, 27 Nov 2013 18:50:13 +0000 (19:50 +0100)]
Fix uninitialized variable error in some peek-char error cases

* libguile/ports.c (scm_peek_char): Don't require error cases to
  set *len.  Fixes a bug caught by GCC whereby an EOF while reading a
  multibyte character with iconv would leave len uninitialized.

10 years agoDeclare scm_i_open_file to silence a warning
Andy Wingo [Wed, 27 Nov 2013 18:36:46 +0000 (19:36 +0100)]
Declare scm_i_open_file to silence a warning

* libguile/fports.c (scm_i_open_file): Declare.

10 years agoRemove generalized vector interface; deprecated in 2.0 already.
Andy Wingo [Wed, 27 Nov 2013 18:31:09 +0000 (19:31 +0100)]
Remove generalized vector interface; deprecated in 2.0 already.

* libguile/deprecated.c: Remove the generalized-vector interface,
  deprecated since 2.0.8.

10 years agoDeclare scm_nil_p
Andy Wingo [Wed, 27 Nov 2013 18:30:18 +0000 (19:30 +0100)]
Declare scm_nil_p

* libguile/boolean.h: Declare scm_nil_p.

10 years agoBuild psyntax-pp serially after eval.go.
Andy Wingo [Tue, 26 Nov 2013 09:47:29 +0000 (10:47 +0100)]
Build psyntax-pp serially after eval.go.

* module/Makefile.am: Arrange to build psyntax-pp.go in serial mode,
  after eval.go.  Before the expander is compiled, expanding all the
  Scheme files dominates compile-time, even for larger files like
  psyntax-pp.scm.  If we compile psyntax in parallel with other files,
  it could be one of the other files finishes first, leading to two
  consecutive compiles that have to use an uncompiled psyntax expander.
  Ordering the compilation minimizes total real and user time, at least
  locally on a 4-core machine.

  Also take the opportunity to shuffle compile order for the rest of the
  Scheme files, to build parts of the RTL compiler early.

10 years agoContification converges more quickly
Andy Wingo [Mon, 25 Nov 2013 19:07:27 +0000 (20:07 +0100)]
Contification converges more quickly

* module/language/cps/contification.scm (compute-contification):
  Converge more quickly by using the information we compute within a
  compute-contification pass.

10 years agoCompute-contification also visits body
Andy Wingo [Sun, 24 Nov 2013 12:59:18 +0000 (13:59 +0100)]
Compute-contification also visits body

* module/language/cps/contification.scm (compute-contification): If we
  decide to contify, don't forget to visit the body.  Should make
  contification converge faster.

10 years agoMake (ice-9 popen) thread-safe.
Mark H Weaver [Sun, 17 Nov 2013 07:54:31 +0000 (02:54 -0500)]
Make (ice-9 popen) thread-safe.

Fixes <http://bugs.gnu.org/15683>.
Reported by David Pirotte <david@altosw.be>.

* module/ice-9/popen.scm: Import (ice-9 threads) and (srfi srfi-9).
  (<pipe-info>): New record type.
  (port/pid-table): Mark as deprecated in comment.
  (port/pid-table-mutex): New variable.
  (open-pipe*): Store the pid in the pipe-info record, and store the
  pipe-info as a port property.  Guard the pipe-info instead of the
  port.  Lock 'port/pid-table-mutex' while mutating 'port/pid-table'.
  (fetch-pid): Removed.
  (fetch-pipe-info): New procedure.
  (close-process-quietly): Removed.
  (close-pipe): Use 'fetch-pipe-info' instead of 'fetch-pid'.  Clear
  the pid from the pipe-info.  Improve error messages.
  (reap-pipes): Adapt to the fact that the pipe-info is now guarded
  instead of the port.  Incorporate the 'waitpid' code that was
  previously in 'close-process-quietly', but let the port finalizer
  close the port.  Clear the pid from the pipe-info.

10 years agoStylistic improvements for (ice-9 popen).
Mark H Weaver [Sun, 17 Nov 2013 07:46:08 +0000 (02:46 -0500)]
Stylistic improvements for (ice-9 popen).

* module/ice-9/popen.scm (close-process, close-process-quietly): Accept
  'port' and 'pid' as separate arguments.  Improve style.
  (close-pipe, read-pipes): Improve style.

10 years agoMake port properties accessible from Scheme.
Mark H Weaver [Sun, 17 Nov 2013 06:11:57 +0000 (01:11 -0500)]
Make port properties accessible from Scheme.

* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New procedures,
  available from Scheme as '%port-property' and '%set-port-property!'.

* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New prototypes.

* libguile/read.c (set_port_read_option, init_read_options): Adapt to
  use scm_i_port_property and scm_i_set_port_property_x.

10 years agoMake guardians thread-safe.
Mark H Weaver [Sun, 17 Nov 2013 08:35:09 +0000 (03:35 -0500)]
Make guardians thread-safe.

* libguile/guardians.c (t_guardian): Add mutex.
  (finalize_guarded, scm_i_guard, scm_i_get_one_zombie): Lock mutex and
  block system asyncs during critical sections.
  (scm_make_guardian): Initialize mutex.

10 years agoBlock system asyncs while 'overrides_lock' is held.
Mark H Weaver [Sun, 17 Nov 2013 08:19:32 +0000 (03:19 -0500)]
Block system asyncs while 'overrides_lock' is held.

* libguile/procprop.c (scm_set_procedure_property_x): Block system
  asyncs while overrides_lock is held.  Use dynwind block in case
  an exception is thrown.

10 years agoAdd mutex locking functions that also block asyncs.
Mark H Weaver [Sun, 17 Nov 2013 09:00:29 +0000 (04:00 -0500)]
Add mutex locking functions that also block asyncs.

* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
  scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.

* libguile/threads.c (do_unlock_with_asyncs): New static helper.
  (scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.

* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
  Add prototype.

10 years agoConvert test-suite/tests/exceptions.test to use hygienic macros.
Chris K. Jester-Young [Sun, 27 Oct 2013 21:31:38 +0000 (17:31 -0400)]
Convert test-suite/tests/exceptions.test to use hygienic macros.

* test-suite/tests/exceptions.test (push): New syntax parameter.
  (throw-test): Convert to a syntax-rules macro, using syntax parameters
  to support the otherwise-unhygienic use of "push".

10 years agoExpandable stacks.
Andy Wingo [Fri, 22 Nov 2013 16:31:07 +0000 (17:31 +0100)]
Expandable stacks.

* libguile/vm-engine.c (CHECK_OVERFLOW): Call vm_expand_stack, not
  vm_error_stack_overflow.
* libguile/vm.c (hard_max_stack_size, default_max_stack_size): Recast
  #defines as locals.  Have both hard and soft stack limits.
  (initialize_default_stack_size): Set soft stack limit from
  GUILE_STACK_SIZE.
  (expand_stack, vm_expand_stack): Support for expanding stacks as
  needed.  Whee!
  (make_vm): Adapt limits.
  (scm_call_n): Expand stack if needed.

* libguile/vm.h (struct scm_vm): Add max_stack_size member.

10 years agoVM copes with moving FP
Andy Wingo [Fri, 22 Nov 2013 17:35:02 +0000 (18:35 +0100)]
VM copes with moving FP

* libguile/_scm.h (SCM_ASYNC_TICK_WITH_GUARD_CODE): New macro.
* libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Restore FP after
  ticking.
  (CACHE_FP): New macro.
  (CHECK_OVERFLOW): Use CACHE_FP.
  (BR_ARITHMETIC, RETURN_EXP, RETURN_ONE_VALUE, BINARY_INTEGER_OP):
  (call, return-values, subr-call, foreign-call)
  (resolve, define!, toplevel-box, module-box): Restore the FP from the
  vp where needed.

10 years agoSimplify state sync in VM before potential bailout.
Andy Wingo [Fri, 22 Nov 2013 17:06:35 +0000 (18:06 +0100)]
Simplify state sync in VM before potential bailout.

* libguile/vm-engine.c (SYNC_IP): Remove calls to SYNC_BEFORE_GC, a
  no-op.  Replace SYNC_REGISTER / SYNC_ALL calls with just SYNC_IP.

10 years agoMore precise stack marking.
Andy Wingo [Fri, 22 Nov 2013 14:02:17 +0000 (15:02 +0100)]
More precise stack marking.

* libguile/vm.c (scm_i_vm_mark_stack): Mark the stack more precisely.

10 years agoAllocate stacks using mmap, and mark them via the thread marker
Andy Wingo [Fri, 22 Nov 2013 13:41:19 +0000 (14:41 +0100)]
Allocate stacks using mmap, and mark them via the thread marker

* libguile/threads.c (thread_mark): Mark the VM stack, if we have one.
  (on_thread_exit): Free the VM stack here.

* libguile/vm.c (make_vm): Allocate the VM stack using mmap, and arrange
  for it to be marked by the thread marker.
  (scm_i_vm_mark_stack, scm_i_vm_free_stack): New internal interfaces.
  (allocate_stack, free_stack): New helpers.

10 years agoAdd thread mark procedure
Andy Wingo [Fri, 22 Nov 2013 12:01:53 +0000 (13:01 +0100)]
Add thread mark procedure

* libguile/threads.c (thread_mark): A mark procedure for threads.
  Eventually will mark the stack.
  (guilify_self_1): Move initialization of VP earlier.  Allocate thread
  using thread_gc_kind.
  (scm_threads_prehistory): Initialize thread_gc_kind.

10 years agoRemove unused scm_i_thread fields
Andy Wingo [Fri, 22 Nov 2013 09:59:14 +0000 (10:59 +0100)]
Remove unused scm_i_thread fields

* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1): Remove unused mark stack fields.

10 years agoRemove tests and shims for pre-7.2 bdw-gc.
Andy Wingo [Fri, 22 Nov 2013 09:51:56 +0000 (10:51 +0100)]
Remove tests and shims for pre-7.2 bdw-gc.

* configure.ac: Remove checks for symbols present in bdw-gc 7.2.

* libguile/finalizers.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/guardians.c:
* libguile/scmsigs.c:
* libguile/threads.c: Remove shims.