1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

1825 commits

Author SHA1 Message Date
Andy Wingo
ee395b7cfb Merge remote-tracking branch 'origin/stable-2.0' 2011-05-26 18:30:37 +02:00
Andy Wingo
f4e45e91f2 lazily init futures worker pool
* module/ice-9/futures.scm (%workers, %create-workers!)
  (create-workers!): Define a mechanism to spawn off the future threads
  only when the first future is created.
  (make-future): Call create-workers! here.
2011-05-26 18:14:32 +02:00
Andy Wingo
a099c8d971 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/procprop.c
2011-05-25 10:32:19 +02:00
Andy Wingo
ad4bd7c2c0 fix define-module ordering
* module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module
  clauses in the order in which they appear in the define-module form.
  Thanks to Jan Nieuwenhuizen for the report.

* test-suite/standalone/test-import-order: Add new test that
  define-module and use-modules resolve the interface in the right
  order.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-import-order-a.scm:
* test-suite/standalone/test-import-order-b.scm:
* test-suite/standalone/test-import-order-c.scm:
* test-suite/standalone/test-import-order-d.scm: Aux files.
2011-05-21 18:29:03 +02:00
Andy Wingo
0dd8493cb3 (syntax foo) -> #'foo in goops
* module/oop/goops.scm: Change instances of (syntax foo) to #'foo.
2011-05-21 13:13:58 +02:00
Andreas Rottmann
b6a66c21fc Improve R6RS conformance wrt. conditions in the I/O libraries
* module/rnrs/io/ports.scm (open-file-output-port): Handle `no-fail'
  file option.
  (with-i/o-filename-conditions): Use `with-throw-handler' instead of `catch'.
  (with-i/o-port-error,
  with-textual-output-conditions. with-textual-input-conditions): New
  exception-conversion helpers.
  (put-char, put-datum, put-string, display): Use
  `with-textual-output-conditions' instead of `with-i/o-encoding-error'
  to get proper conditions in case of write errors.
  (get-char, get-datum, get-line, get-string-all, lookahead-char):
  Likewise, for the input case.

* test-suite/tests/r6rs-ports.test (pass-if-condition, test-file,
  make-failing-port): New helpers.
  ("8.2.10 Output ports"): Add some tests for `open-file-output-port'.
  ("8.2.9 Textual Input"): Add tests read error conditions.
  ("8.2.12 Textual Output"): Add tests for write error conditions.
  ("8.3 Simple I/O"): Add tests for conditions, `call-with-input-file'
  and `call-with-output-file'.
2011-05-14 19:29:26 +02:00
Andy Wingo
fc7bd367ab remove all deprecated code
* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code.  CPP defines
  that were not previously issuing warnings were changed so that their
  expansions would indicate the replacement forms to use,
  e.g. scm_sizet__GONE__REPLACE_WITH__size_t.

  The two exceptions were SCM_LISTN, which did not produce warnings
  before, and the string-filter argument order stuff.

  Drops the initial dirty memory usage of Guile down to 2.8 MB on my
  machine, from 4.4 MB.
2011-05-12 14:01:26 +02:00
Andy Wingo
d147fe2e68 all deprecated routines emit warnings
* module/ice-9/deprecated.scm (substring-move-left!)
  (substring-move-right!, dynamic-maybe-call, dynamic-maybe-link)
  (try-module-linked, try-module-dynamic-link)
  ($asinh, $acosh, $atanh, $sqrt, $abs, $exp, $log, $sin, $cos)
  ($tan, $asin, $acos, $atan, $sinh, $cosh, $tanh)
  (process-define-module): Add deprecation warnings.
2011-05-12 13:07:19 +02:00
Andy Wingo
8f6a4b248b fix some duplication in object tables
* module/language/glil/compile-assembly.scm (build-object-table): Don't
  add the same value to an object table twice.
2011-05-08 22:55:05 +02:00
Ludovic Courtès
19301dc56d Add `vhash-fold-right'.
* module/ice-9/vlist.scm (vhash-fold-right): New procedure.

* test-suite/tests/vlist.test ("vhash")["vhash-fold-right"]: New test.

* doc/ref/api-compound.texi (VHashes): Document `vhash-fold-right'.
2011-05-08 18:20:42 +02:00
Ludovic Courtès
bc00e06c7e Optimize `vlist-fold-right'.
* module/ice-9/vlist.scm (vlist-fold-right): Avoid `vlist-reverse' and
  instead `vlist-ref' individual elements.  The result is about twice
  faster.  Thanks Andy for suggesting it indirectly.  :-)
2011-05-08 18:20:42 +02:00
Andy Wingo
cb7523c26d compile-assembly: cleanup
* module/language/glil/compile-assembly.scm: Clean up code for
  subprograms (not needed, we just cache the glil) and object alists
  (replaced by constants tables).
2011-05-08 16:38:32 +02:00
Andy Wingo
f5695488b9 compile-assembly: use file-level constants table
* module/language/glil/compile-assembly.scm (compile-assembly): Rework
  to handle toplevel-specific code generation here, instead of in
  glil->assembly.  Specifically, here we build a global constant table,
  and arrange for it to be the objtable of the toplevel thunk.

  (compile-program): New helper, compiles a <glil-program> and returns
  just the (load-program ...) form.

  (compile-objtable): New helper, generates assembly to build an object
  table, using some other constants table, and possibly recursing to
  `compile-program' for cached GLIL programs.

  (glil->assembly): Simplify, removing the toplevel? argument, and
  replacing the object alist with an objtable computed in a previous
  pass.  Adapt to the new form of the objtable, and to use
  compile-program and compile-objtable.
2011-05-08 16:37:47 +02:00
Andy Wingo
7e7b8991b2 compile-assembly: add dump-constants, a new helper
* module/language/glil/compile-assembly.scm (dump-constants): New
  helper.  Generates bytecode that will result in a vector for the
  global object table being pushed on the stack.  The items in the
  global object table will share state as much as possible.
2011-05-08 16:31:18 +02:00
Andy Wingo
57b8eca691 compile-assembly: add build-constant-store, build-object-table
* module/language/glil/compile-assembly.scm (immediate?): New helper.
  (build-constant-store): New helper.  Walks the GLIL tree and builds up
  a constant table, as a vhash.
  (build-object-table): Another helper, builds a constant table for a
  given GLIL program.
2011-05-08 16:15:25 +02:00
Andy Wingo
6994fa9fef compile-assembly: make-meta refactor
* module/language/glil/compile-assembly.scm (make-meta): Avoid going
  through the compiler.
2011-05-08 16:13:41 +02:00
Andy Wingo
55fb5058a8 compile-assembly: add traversal helpers
* module/language/glil/compile-assembly.scm (vhash-fold-right2):
  (fold2, vector-fold2): Add some traversal helpers that we'll use in
  the next commit.
2011-05-08 16:09:22 +02:00
Andreas Rottmann
2252321bb7 Make the R6RS simple I/O library use conditions
* module/rnrs/io/ports.scm (display): Implement as an
  exception-converting wrapper around Guile's core display.
* module/rnrs/io/simple.scm: Don't export Guile's corresponding core
  procedures, but use `(rnrs io ports)' instead.  This way, we get the
  conditions required by R6RS raised.

* doc/ref/r6rs.texi (rnrs io simple): Mention that these procedures are
  supposed to raise R6RS conditions.
2011-05-07 23:48:46 +02:00
Andy Wingo
b706a01129 fix srfi-1 map-in-order definition
* module/srfi/srfi-1.scm (map-in-order): As we are not extending the
  core `map' binding, actually make a new `map-in-order' alias here.
  Fixes fresh builds.
2011-05-07 11:31:38 +02:00
Andy Wingo
a2230b653b map and for-each in scheme
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
  of C.  There are boot versions before `cond' is defined.
  (map-in-order): Define this alias here instead of in evalext.h.

* libguile/eval.c: Stub out the map and for-each definitions to just
  call into Scheme.

* libguile/evalext.c: Remove map-in-order definition.

* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
  (map, for-each): Define implementations here, in Scheme, instead of in
  C.

* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
  expected exception for mapping over lists of different lengths.

* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions.  Remove the
  bit that extended the core `map' primitive with another method: the
  right way to do that is with modules.
2011-05-05 23:07:37 +02:00
Andy Wingo
e2ccab571e psyntax simplification
* module/ice-9/psyntax.scm (strip): Inline the and-map* definition to
  its one call site.

* module/ice-9/psyntax-pp.scm: Regenerate.
2011-05-05 23:07:37 +02:00
Andy Wingo
9e775af3bf srfi-1 `member' in scheme, inlines to memq / memv in some cases
* libguile/srfi-1.c:
* libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme.

* module/srfi/srfi-1.scm (member): Implement here, with the inlining
  cases for eq? and eqv?.  Speeds up a compiled bootstrap of
  psyntax.scm, because lset-adjoin inlines to the memq case.
  (lset<=): Reindent.

  (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass
  it through to `member', so we inline to memq / memv.  Use something
  closer to the reference implementations.
2011-05-05 12:59:07 +02:00
Andy Wingo
89f9dd7065 speed up compile-bytecode
* module/language/assembly/compile-bytecode.scm (compile-bytecode):
  Rewrite to fill a bytevector directly, instead of using bytevector
  ports.  `write-bytecode' itself is still present and almost the same
  as before; it's just that `write-byte' et al now inline the effect of
  writing a byte to a binary port.

* test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use
  public interfaces.
2011-05-05 11:43:12 +02:00
Andy Wingo
81f529091b silly "optimization" in (language assembly)
* module/language/assembly.scm (byte-length): Silly, minor tweak: put
  the fixed-length instruction case first.  Seems to shave some 10% off
  the time compiling psyntax.scm (when the whole rest of the system is
  compiled, of course).
2011-05-05 11:43:12 +02:00
Andy Wingo
2d239a78d4 add gcprof
* module/statprof.scm (gcprof): New variant of statprof; instead of
  being driven by setitimer, this one is driven by the after-gc-hook.
2011-05-05 11:43:12 +02:00
Andy Wingo
e640b44046 minor statprof tweaks
* module/statprof.scm (statprof-reset): Make full-stacks? into an
  optional arg instead of doing the rest arg dance.
  (statprof-display): Format gc-time-taken appropriately.
2011-05-05 11:43:12 +02:00
Daniel Llorens
7ff0f239b2 Fix call-with-input-file & relatives for multiple values
* module/ice-9/r4rs.scm (call-with-input-file, call-with-output-file): Rewrite
  with call-with-values.
  (with-input-from-file): use call-with-input-file.
  (with-output-to-file, with-error-to-file): use call-with-output-file.
  Update docstrings to make clear that multiple values may be yielded.
2011-05-02 23:23:51 +02:00
Andy Wingo
8bee35bc53 (ice-9 poe) does not get handles from weak hash tables
* module/ice-9/poe.scm (pure-funcq, perfect-funcq): Reimplement to not
  use get-handle.
2011-05-01 23:01:13 +02:00
Andy Wingo
eceee4efe3 boot-9 fixme note
* module/ice-9/boot-9.scm (module-replace!): Add a fixme about using
  something other than object properties here.
2011-05-01 23:01:13 +02:00
Andy Wingo
04b04af85a fix free-id=? for module-bound keywords
* module/ice-9/psyntax.scm (free-id=?): For identifiers that are
  resolved to the toplevel, check that the variables that they would
  resolve to are equal, instead of simply checking that the symbolic
  identifier names are equal.  Allows keywords to be bound, renamed,
  exported, excluded, etc.

* module/ice-9/psyntax-pp.scm: Regenerate.
2011-04-29 16:37:42 +02:00
Andy Wingo
aa5698fb53 eval-when matches situations symbolically
* module/ice-9/psyntax.scm (chi-when-list): Just match symbolically
  instead of lexically, so as not to tie the meaning of eval-when to the
  bindings of eval, load, compile, and expand.
2011-04-29 16:36:50 +02:00
Andy Wingo
5138551787 oop goops comment
* module/oop/goops.scm: Add a note about the need to deprecate
  min-fixnum and max-fixnum.
2011-04-29 16:36:50 +02:00
Andy Wingo
b735d33b2b psyntax simplification
* module/ice-9/psyntax.scm (id-var-name): Just rely on multiple-values
  truncation.
2011-04-29 11:14:56 +02:00
Andy Wingo
e6efefad08 -x error message fix
* module/ice-9/command-line.scm (compile-shell-switches): Fix error
  message for -x switch.
2011-04-28 21:45:02 +02:00
Andy Wingo
dac9812a2e fix double-loading of script in -ds case
* module/ice-9/command-line.scm (compile-shell-switches): In the -ds
  case, we were erroneously loading the script twice.  Fix that.
2011-04-28 21:43:01 +02:00
Andy Wingo
91956a94fe allow while as an expression
* module/ice-9/boot-9.scm (while): Specify the return value as #f under
  normal conditions, #t under (break), and arg... under (break arg...).
* test-suite/tests/syntax.test ("while"): Test.
* doc/ref/api-control.texi (while do): Document.
2011-04-28 15:48:35 +02:00
Andy Wingo
18e444b40e add reset and shift
* module/ice-9/control.scm (reset, shift): Add implementations of these
  operators from Wolfgang J Moeller, derived from implementations by
  Oleg Kiselyov.
  (reset*, shift*): Procedural variants.

* test-suite/tests/control.test ("shift and reset"): Add tests,
  originally from Oleg Kiselyov.
2011-04-28 15:48:28 +02:00
Ludovic Courtès
756b1dfa6e Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).
Partially reverts 165b10ddfa and
531c9f1dc5.

* module/srfi/srfi-9.scm (define-inlinable): New macro.
2011-04-27 22:26:05 +02:00
Ludovic Courtès
94b55d3fa0 Gracefully handle `setlocale' errors at the REPL.
* module/ice-9/top-repl.scm (top-repl): Catch exceptions from
  `setlocale'.  Reported by CRLF0710 <crlf0710@gmail.com>.
2011-04-27 00:57:53 +02:00
Andy Wingo
1e56cff233 add --fresh-auto-compile
* doc/ref/api-evaluation.texi (Compilation): Add discussion of
  --fresh-auto-compile.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile
  option.

* NEWS: Add entry.

* libguile/load.c: Define %fresh-auto-compile.
  (scm_primitive_load_path): Use it here.
  (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env
  var, with a value of "fresh".

* module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is
  stale if %fresh-auto-compile is true.

* module/ice-9/command-line.scm (compile-shell-switches): Parse out
  --fresh-auto-compile.
2011-04-15 11:27:27 +02:00
Ludovic Courtès
073167ef7b Allow compilation with `--disable-posix'.
Reported by Dmitry Dzhus <dima@dzhus.org>.

* configure.ac: Remove `AC_LIBOBJ([filesys])'.  Document
  `--disable-posix' as omitting non-essential POSIX interfaces.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  Add `filesys.c'.
  (DOT_DOC_FILES): Add `filesys.doc'.
  (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove
  `filesys.c'.

* libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'.
  (scm_init_posix): Move `R_OK' etc. to `filesys.c'.

* libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes,
  scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir,
  scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir,
  scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd,
  set_element, fill_select_type, get_element, retrieve_select_type,
  scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink,
  scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX.
  (scm_mkstemp, scm_access): New functions.
  (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on
  HAVE_POSIX.  Define `R_OK', `W_OK', etc.

* libguile/fports.c (fport_print): Use `scm_ttyname' only when
  HAVE_POSIX.

* libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New
  functions.  Update users of `scm_i_locale_mutex' to use them.

* libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'.

* meta/guile-tools.in (main): Use `setlocale' only when it is defined.

* module/ice-9/boot-9.scm: Always load `ice-9/posix'.
2011-04-15 00:09:16 +02:00
Andy Wingo
3936cebc77 fix analyze.scm literal string warnings
* module/language/tree-il/analyze.scm (const-fmt): Return any literal
  value, not just strings.  The string case is checked later.
2011-04-14 16:53:18 +02:00
Andy Wingo
90779ad9a1 fix embarrassing bugs in (ice-9 command-line)
* module/ice-9/command-line.scm (compile-shell-switches): Whoops, fix a
  few cases that forgot to loop back to the beginning.
2011-04-14 16:46:49 +02:00
Andy Wingo
e07f0a5566 guile -v prints LGPLv3+.
* module/ice-9/command-line.scm (compile-shell-switches): Though Guile
  may be distributed under the GPLv3, Guile is actually LGPLv3+.
2011-04-14 16:18:56 +02:00
Andy Wingo
da5d81a1f7 add (ice-9 command-line)
* module/ice-9/command-line.scm: New module for parsing Guile's command
  line, ported from script.c.  Includes local eval-string implementation
  to make `guile -c 1' faster, by not having to load the compiler.
* module/Makefile.am: Add to build.
2011-04-14 16:06:07 +02:00
Andy Wingo
56e313894b don't warn about non-literal fmt strings for e.g. (_ "foo")
* module/language/tree-il/analyze.scm (const-fmt, format-analysis):
  Allow format strings to be gettexted, using the conventional _ name.
2011-04-14 16:04:18 +02:00
Andy Wingo
9d6a151fbd (rnrs arithmetic fixnums) fixnum? export a procedure again
* module/rnrs/arithmetic/fixnums.scm (fixnum?): Restore this export to
  be a procedure, not syntax.
  (inline-fixnum?): This is what fixnum? was.  Use it internally.
2011-04-13 12:50:41 +02:00
Andy Wingo
37325c9bd2 revert 4a2ac0623c
* module/ice-9/popen.scm (open-pipe*): No need to pump the pipes
  guardian here, now that hooks are working again.
2011-04-13 12:50:41 +02:00
Ian Price
15993bce1c fix assert to return true value.
* module/rnrs/base.scm (assert): returns value instead of void.

* test-suite/tests/r6rs-base.test ("assert"): add test cases.
2011-04-11 18:00:36 +02:00
Ian Price
cf9d4a8214 Added optional second arg to R6RS log function
* module/rnrs/base.scm (log): now takes a base argument, using the
  change of base formula for logs.
* test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases.
2011-04-11 17:58:12 +02:00