1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

17263 commits

Author SHA1 Message Date
Andy Wingo
b352309301 New module (language cps intmap)
* module/language/cps/intmap.scm: New file.
* module/Makefile.am: Add to build.
2014-06-29 14:30:25 +02:00
Andy Wingo
6fe36f220e Rewrite CSE to use intsets.
* module/language/cps/cse.scm: Rewrite using intsets.
2014-06-29 14:26:02 +02:00
Andy Wingo
b1103eb980 New module: (language cps intset)
* module/Makefile.am: Add to build.
* module/language/cps/intset.scm: New file.
2014-06-29 14:19:03 +02:00
Andy Wingo
d40b05386c Fix bit-count* bug
* libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in
  2005 refactor (!) in which the second arg was erroneously taken from
  the first arg.

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

* doc/ref/api-compound.texi: Fix doc example for u32vector selector.
2014-06-29 14:19:00 +02:00
Eli Zaretskii
c7161ee334 Fix compilation of scm_nl_langinfo when some nl_langinfo items are missing.
* i18n.c (scm_nl_langinfo): Don't assume that both INT_* and
  the corresponding non-INT_* items are always either all defined
  or all undefined.
2014-06-22 19:11:30 +03:00
Andy Wingo
ec412d7562 Rewrite type inference pass to use namesets
* module/Makefile.am: Build types.scm early, but don't block the rest of
  the build on it.

* module/language/cps/types.scm: Rewrite to use namesets.

* module/language/cps/dce.scm:
* module/language/cps/type-fold.scm: Adapt to interface changes.
2014-06-22 12:19:29 +02:00
Andy Wingo
97ed2e77ab New module: (language cps nameset)
* module/language/cps/nameset.scm: New file.
* module/Makefile.am: Add new file.
2014-06-22 11:28:18 +02:00
Andy Wingo
38c7bd0e77 Refactor dominator computation
* module/language/cps/cse.scm:
* module/language/cps/dfg.scm (compute-idoms, compute-dom-edges): Move
  these procedures from cse.scm to dfg.scm.
  Remove loop-detection code; that can come back later but it is
  bitrotten for now.
2014-06-19 08:48:07 +02:00
Andy Wingo
803a1ee7c7 Constant folding for (list) and (vector) in peval
* module/language/tree-il/peval.scm (peval): Add cases for (list) -> '()
  and (vector) -> #().
2014-06-19 08:47:25 +02:00
Ludovic Courtès
f089330846 tests: Improve lack-of-/dev/null detection.
Suggested by Eli Zaretskii <eliz@gnu.org>.

* test-suite/test-suite/lib.scm (%null-device): Test for Windows based
  by checking for a drive letter in the current directory name.
2014-06-12 23:19:37 +02:00
Ludovic Courtès
700f6cd86b i18n: Adjust tests for Windows.
* test-suite/tests/i18n.test (mingw?): New variable.
  (%french-locale-name, %french-utf8-locale-name,
  %turkish-utf8-locale-name, %german-utf8-locale-name,
  %greek-utf8-locale-name): Add name of corresponding Windows codepage,
  when MINGW? is true.
  (under-turkish-utf8-locale-or-unresolved): Add exception for
  "mingw32".

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
2014-06-11 15:03:31 +02:00
Ludovic Courtès
c84f25bcce i18n: Ignore LC_MESSAGES on MinGW.
* libguile/locale-categories.h (MESSAGES): Add condition on
  !(defined(LC_MAX) && LC_MESSAGES > LC_MAX).
* test-suite/tests/i18n.test ("locale objects")["make-locale (2 args,
  list)", "make-locale (3 args)", "locale?"]: Use LC_NUMERIC or LC_TIME
  instead of LC_MESSAGES.

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
2014-06-11 14:54:21 +02:00
Ludovic Courtès
82b8cfa40c tests: Use NUL instead of /dev/null on MinGW.
Reported by Eli Zaretskii <eliz@gnu.org>.

* test-suite/test-suite/lib.scm (%null-device): New variable.
* test-suite/tests/c-api.test (egrep): Use %NULL-DEVICE instead of
  /dev/null.
* test-suite/tests/popen.test ("open-input-pipe")["no duplicate"]:
  Likewise.
2014-06-11 14:36:55 +02:00
Ludovic Courtès
fab18c02e8 Use the right GC version macros.
Reported by Doug Evans <xdje42@gmail.com>.

* libguile/gc.c (scm_storage_prehistory): Use GC_VERSION_MICRO, not
  GC_ALPHA_VERSION.
2014-06-09 19:26:55 +02:00
Taylan Ulrich B
43191a31a5 R6RS library documentation fix
* doc/ref/api-modules.texi (R6RS Libraries): Move 'export' before
  'import' in the example library form, as required by R6RS.
2014-06-06 16:38:09 -04:00
Dmitry Bogatov
d86a063158 Fix typo in `transform-string' doc.
* doc/ref/texinfo.texi: Fix single typo.

Signed-off-by: Dmitry Bogatov <KAction@gnu.org>
2014-06-04 20:59:36 -04:00
Mark H Weaver
fc8a90043b Optimize scm_ilength and 'length+'.
* libguile/list.c (scm_ilength): Test for SCM_NULL_OR_NIL_P only after
  testing scm_is_pair.  Conform to GNU coding standards.

* libguile/srfi-1.c (scm_srfi1_length_plus): Ditto.
2014-06-04 20:42:21 -04:00
Mark H Weaver
4afca1a066 test-guild-compile: Increase sleep time before sending SIGINT.
* test-suite/standalone/test-guild-compile: Increase sleep time
  before sending SIGINT, for slow machines.
2014-06-04 20:40:23 -04:00
Mark H Weaver
1ea8954814 Avoid quadratic expansion time in 'and' and 'or' macros.
Fixes <http://bugs.gnu.org/17147>.
Reported by David Kastrup <dak@gnu.org>.

* module/ice-9/boot-9.scm (and, or): Use dotted tail instead of ellipsis
  in patterns.
2014-06-04 19:37:50 -04:00
Ludovic Courtès
2da97f1c7c 'guild compile' doesn't leave temporary files behind it.
* module/scripts/compile.scm (compile): Add 'sigaction' call.
* test-suite/standalone/test-guild-compile: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
2014-06-03 15:01:58 +02:00
Mark H Weaver
a5186f506f SRFI-1 'length+' raises an error unless passed a proper or circular list.
Fixes <http://bugs.gnu.org/17296>.

* libguile/srfi-1.c (scm_srfi1_length_plus): Rewrite to raise an error
  unless passed a proper or circular list, based on code from
  'scm_ilength'.

* test-suite/tests/srfi-1.test (length+): Add tests.
2014-06-01 19:19:40 -04:00
Mark H Weaver
12c6a47773 Mark system async functions as SCM_API.
Fixes <http://bugs.gnu.org/17661>.
Reported and fixed by Chris Vine <chris@cvine.freeserve.co.uk>.

* libguile/async.h (scm_c_call_with_blocked_asyncs)
  (scm_c_call_with_unblocked_asyncs, scm_dynwind_block_asyncs)
  (scm_dynwind_unblock_asyncs): Mark as SCM_API.

* THANKS: Add Chris Vine to fixes section.
2014-06-01 19:12:25 -04:00
Andy Wingo
59258f7cad Remove $kif
* module/language/cps.scm: Remove $kif.

* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/prune-top-level-scopes.scm:
* module/language/cps/renumber.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm:
* module/language/cps/verify.scm: Adapt.
2014-05-31 21:43:12 -04:00
Andy Wingo
fd61004764 CPS conversion produces $branch nodes, not $kif
* module/language/tree-il/compile-cps.scm (unbound?, convert): Create
  $branch nodes instead of $kif nodes.
2014-05-31 21:15:13 -04:00
Andy Wingo
92805e2197 Add $branch expression type
* module/language/cps.scm ($branch): New expression type; will replace
  $kif.

* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/primitives.scm:
* module/language/cps/renumber.scm:
* module/language/cps/self-references.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm:
* module/language/cps/verify.scm: Adapt to $branch expression type.
2014-05-31 21:15:06 -04:00
Andy Wingo
c90e2c6087 Fix source-line-for-user for unknown line
* module/system/vm/debug.scm (source-line-for-user): Fix to allow for
  unknown lines.
2014-05-31 21:15:06 -04:00
Andy Wingo
51177f3515 Fix off-by-one in dump-dfg
* module/language/cps/dfg.scm (dump-dfg): Fix bug where the last
  continuation wasn't printed.
2014-05-31 21:15:06 -04:00
Andy Wingo
5062a56df0 Fix compute-predecessors bug in frame.scm
* module/system/vm/frame.scm (compute-predecessors): Fix bug in
  resolving targets of backwards branches.
2014-05-31 21:15:05 -04:00
Ludovic Courtès
a43fa1b706 Slightly simplify 'scm_open_process'.
* libguile/posix.c (scm_open_process): Call 'scm_fdes_to_port' with the
  '0' flag, and remove 'scm_setvbuf' calls.
2014-05-28 23:06:45 +02:00
Ludovic Courtès
a41b07a34f rdelim: Speed up 'read-string' (aka. 'get-string-all'.)
This yields a 20% improvement on the "read-string" benchmark.

* module/ice-9/rdelim.scm (read-string): Rewrite as a 'case-lambda',
  with a tight loop around 'read-char', and without using
  'read-string!'.
* test-suite/tests/rdelim.test ("read-string")["longer than 100 chars,
  with limit"]: New test.
* benchmark-suite/benchmarks/ports.bm ("rdelim")["read-string"]: New
  benchmark.
2014-05-28 23:00:20 +02:00
Ludovic Courtès
eb6ac6efcd tests: Add test for <http://bugs.gnu.org/17466>.
* test-suite/tests/r6rs-ports.test ("7.2.8 Binary
  Input")("http://bugs.gnu.org/17466"): New test.
2014-05-28 22:19:16 +02:00
Ludovic Courtès
1baa215930 Fix shrinking of contiguous bytevectors, as from 'get-bytevector-n'.
Fixes <http://bugs.gnu.org/17466>.
Reported by J Kalbhenn <jkal@posteo.eu>.

* libguile/bytevectors.c (scm_c_shrink_bytevector): When BV is
  contiguous, add use of 'SCM_BYTEVECTOR_SET_CONTENTS'.
2014-05-28 19:26:45 +02:00
Ludovic Courtès
0bb3f946e9 web: Keep the default size for the client's in-kernel receive buffer.
Fixes <http://bugs.gnu.org/15368>.

* module/web/client.scm (open-socket-for-uri): Remove call to
  'setsockopt'.  Contrary to what the comment said, its effect was to
  shrink the receive buffer from 124 KiB (the default size, per
  /proc/sys/net/core/rmem_default on Linux-based systems) to 12 KiB.
2014-05-23 22:02:30 +02:00
Ludovic Courtès
c497bfb1f6 tests: Add test for _IOLBF.
* test-suite/tests/ports.test ("pipe, fdopen, and _IOLBF"): New test.
2014-05-21 15:34:22 +02:00
Andy Wingo
146c8e72a9 Update effects-analysis docstring.
* module/language/cps/effects-analysis.scm: Update docs.
2014-05-16 16:57:58 +02:00
Andy Wingo
e7f2fe1bb7 Redefine memory kind part of effects to be enumeration, not flags
* module/language/cps/effects-analysis.scm (define-enumeration): New
  helper.
  (&memory-kind-mask): Define as an enumeration, not a bitfield.  Add
  &unknown-memory-kinds.
  (&all-effects, effect-clobbers?, make-prompt-tag, expression-effects):
  Adapt.

Note that this change requires dce.go and cse.go to be recompiled.
2014-05-16 16:17:53 +02:00
Ludovic Courtès
5e793ad851 Silence GCC warning.
* libguile/fports.c (scm_setvbuf): Initialize 'drained'.  GCC 4.9 raises
  a "may be used uninitialized warning" for 'drained', because it can't
  tell that 'drained' is initialized anytime NDRAINED > 0.
2014-05-16 11:32:43 +02:00
Andy Wingo
3be43fb782 DCE uses type analysis to elide type checks
* module/language/cps/dce.scm (elide-type-checks!, compute-live-code):
  Replace old ad-hoc type check elision with one driven from type
  analysis.  Type check elision only operates on smallish functions, to
  avoid n**2 explosion in type inference.
2014-05-15 17:39:24 +02:00
Andy Wingo
a7ee377dbe Limit impact of O(n^2) type analysis by imposing limit
* module/language/cps/types.scm (infer-types): Add #:max-label-count
  argument.

* module/language/cps/type-fold.scm (compute-folded, fold-constants*):
  Disable for big functions.  Perhaps we can relax this if we find an
  O(n log n) way to represent types.
2014-05-15 17:39:24 +02:00
Andy Wingo
a77e3a7c8a Compile language/cps/types.scm early
* module/Makefile.am (BOOT_SOURCES, BOOT_GOBJECTS): New variables.
  (CLEANFILES, nobase_mod_DATA, nobase_ccache_DATA, EXTRA_DIST)
  (ETAGS_ARGS): Use the new variables.

  (CPS_LANG_SOURCES): Remove language/cps/types.scm, as it is a boot
  file.
2014-05-15 17:39:24 +02:00
Andy Wingo
6129faa0f5 Enable type folding
* module/language/cps/compile-bytecode.scm (optimize): Enable type
  folding.
2014-05-15 17:39:24 +02:00
Andy Wingo
8bc65d2d64 Type and range inference for CPS
* module/language/cps/types.scm: New file, implementing type and range
  inference over CPS.

* module/language/cps/type-fold.scm: New file, implementing abstract
  constant folding for CPS.

* module/Makefile.am: Add the new files.

* module/language/cps/compile-bytecode.scm: Wire up type-fold, but
  currently disabled.
2014-05-15 17:39:19 +02:00
Andy Wingo
7ed92f0a9c Add syntax-parameterize indentation to .dir-locals.el.
* .dir-locals.el: Add syntax-parameterize indentation.
2014-05-12 09:41:58 +02:00
Andy Wingo
5d25fdae37 Rewrite effects analysis to be precise for fields.
* module/language/cps/effects-analysis.scm: Rewrite so that instead of
  the depends/causes effects, there is just &type-check, &allocation,
  &read, and &write.  The object kind is a separate part of the
  bitfield, and the field in the object (if appropriate) is another
  field.  Effects are still a fixnum.  This enables precise effects for
  vectors and structs on all architectures.

  This kind of effects analysis was not possible in Tree-IL because
  Tree-IL relied on logior-ing effects of subexpressions, whereas with
  CPS we have no sub-expressions and we do flow analysis instead.

  (effect-clobbers?): Replace effects-commute? with this inherently
  directional and precise predicate.

* module/language/cps/cse.scm (compute-always-available-expressions):
  (compute-equivalent-subexpressions): Adapt to effects analysis
  change.
* module/language/cps/dce.scm (compute-live-code): Likewise.
2014-05-08 10:39:49 +02:00
Andy Wingo
466bdf7ee3 CSE effects analysis cleanup
* module/language/cps/cse.scm (compute-always-available-expressions):
  Use constant? instead of zero?, to avoid punching through the effects
  abstraction.
2014-05-07 17:10:15 +02:00
Andy Wingo
fb512cac6e Add dump-dfg pretty-printer
* module/language/cps/dfg.scm (dump-dfg): New pretty-printer.  Under
  construction.
2014-05-07 15:28:50 +02:00
Andy Wingo
c8d87b4745 Synthetic definitions take advantage of CSE'd vars
* module/language/cps/cse.scm (compute-available-expressions):
  Simplify initialization.
  (compute-equivalent-subexpressions): When synthesizing definitions,
  use substed vars.  Add synthetic definitions after processing an
  expression, to take advantage of the substed vars.
2014-05-07 15:28:12 +02:00
Andy Wingo
aa980ce0dc Fix thinko in synthesize-definition-effects!
* module/language/cps/effects-analysis.scm (synthesize-definition-effects!):
  Fix a boneheaded thinko that caused all primcalls to be marked as
  causing car, cdr, vector, struct, and box effects.
2014-05-07 15:25:13 +02:00
Andy Wingo
7af8115675 Fix frame-call-representation for frames from apply-hook
* module/system/vm/frame.scm (frame-call-representation): Fix when
  called on frames that are created from the apply hook.
2014-05-04 22:51:34 +02:00
Andy Wingo
423164efa6 Program printing tweaks
* module/system/vm/program.scm (print-program): New public interface --
  the guts of write-program, but refactored to be able to work when only
  given an addr.
  (write-program): Use print-program.

* module/system/vm/frame.scm (frame-call-representation): Remove attempt
  to abbreviate procedure representations; was confusing because the
  result would write as a string, quotes and all.
2014-05-04 22:41:48 +02:00