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

3117 commits

Author SHA1 Message Date
Andy Wingo
c5ea75534c Add (ice-9 unicode) module
* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

* doc/ref/api-data.texi: Add docs.
2014-09-12 17:00:59 +02:00
Ludovic Courtès
8ac39b38d1 Handle ~p in 'format' warnings.
Fixes <http://bugs.gnu.org/18299>.
Reported by Frank Terbeck <ft@bewatermyfriend.org>.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Add case for ~p.
* test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too
  few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few
  arguments"): New tests.
2014-08-26 23:41:33 +02:00
Andy Wingo
7f5887e70b Separate &boolean type into &true and &false
* module/language/cps/types.scm (&all-types): Represent true and false
  as separate bits, so that #f can be removed from types on true
  branches.  Adapt all users.

* module/language/cps/type-fold.scm (&scalar-types):
  (fold-and-reduce): Adapt to boolean type representation change.
2014-08-24 17:07:49 +02:00
Ian Price
b072b8e692 Provide curried version of define*-public.
* module/ice-9/curried-definitions.scm (define*-public): New macro.
2014-07-31 16:05:58 +01:00
Ian Price
8857e271d8 Prevent add-to-load-path from adding duplicate entries
* module/ice-9/boot-9.scm (add-to-load-path): Remove argument from
  %load-path (if it exists) before pushing. This also means that the
  `elt' will always be at the front of %load-path.
2014-07-30 19:22:04 +01:00
Andy Wingo
b9a5bac690 Better simplification of literal constants that continue to branches
* module/language/cps/simplify.scm (eta-reduce): Constants that continue
  to branches eta-reduce to the true or false branch.
2014-07-22 12:18:07 +02:00
Andy Wingo
ae67b159bb CPS will not see "not" primcalls
* module/language/tree-il/compile-cps.scm (convert): Remove "not"
  primcalls.

* module/language/cps/effects-analysis.scm (values):
* module/language/cps/types.scm: Remove special cases for the "not"
  primcall.
2014-07-22 12:18:07 +02:00
Andy Wingo
44954194c9 Simplify pass rewrite scope tree to reflect dominator tree
* module/language/cps/simplify.scm (redominate): Add micropass to
  rewrite the scope tree to reflect the dominator tree.  Will enable
  better eta reduction.
2014-07-22 12:18:07 +02:00
Andy Wingo
7700e67226 Remove dead case in CSE
* module/language/cps/cse.scm (apply-cse): Remove a case that couldn't
  occur.
2014-07-22 12:18:07 +02:00
Andy Wingo
6fc634f8a3 CSE allocate-struct fix
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
  Fix handling of allocate-struct in tail position.
2014-07-21 21:38:17 +02:00
Andy Wingo
30411abf5c Fix typo in arities.scm
* module/language/cps/arities.scm (fix-arities*): Fix typo.
2014-07-21 21:38:17 +02:00
Andy Wingo
cf7a884f12 Stabilize renumber.scm:sort-conts.
* module/language/cps/renumber.scm (sort-conts): Prevent spurious
  continuation reordering.
2014-07-21 21:38:17 +02:00
Andy Wingo
ebca3afedb Fix allocate-slots for $kreceive with multiple predecessors
* module/language/cps/slot-allocation.scm (allocate-slots): For
  continuations of $call, $callk, and $values with multiple
  predecessors, recalculate the set of live slots.  Fixes miscompilation
  of ice-9/futures.scm:process-future!, broken since the previous patch,
  now that $kreceive continuations can have multiple predecessors.
2014-07-21 11:47:43 +02:00
Andy Wingo
6d7b6a171e Block sorting to keep loop bodies together
* module/language/cps/renumber.scm (compute-new-labels-and-vars):
  (compute-tail-path-lengths, sort-conts): Arrange to visit successors
  in such a way that if branches are unsorted, the longest path length
  will appear first.  This keeps loop bodies together.
2014-07-05 15:46:48 +02:00
Ludovic Courtès
ffd3e55cfd Recognize more ARM targets.
Suggested by Dale P. Smith.

* module/system/base/target.scm (cpu-endianness): Add cases for
  "arm.*eb", "^aarch64.*be", and "aarch64".  Change "arm" case to
  "arm.*".
  (triplet-pointer-size): Allow underscore as in 'aarch64_be'.
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")["armeb-unknown-linux-gnu",
  "aarch64-linux-gnu", "aarch64_be-linux-gnu"]: New tests.
2014-07-04 17:26:41 +02:00
Ludovic Courtès
df8c52e93d Recognize arm-* target triplets.
Reported by Sylvain Beucler <beuc@beuc.net>.

* module/system/base/target.scm (cpu-endianness): Add case where CPU is
  "arm".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")["arm-unknown-linux-androideabi"]:
  New test.
2014-07-04 15:35:55 +02:00
Andy Wingo
9243902a9d logbit? strength reduction
* module/language/cps/type-fold.scm (fold-and-reduce): Don't require
  types to check out; it could be that the reduced expression can
  exhibit the same type-check effects.  Reduce for all continuations,
  even $kreceive.  Pass dfg to reducer.
  (mul): Check types.
  (logbit?): New reducer.
2014-07-04 12:42:16 +02:00
Andy Wingo
74fe7fae00 Fix logand range analysis.
* module/language/cps/types.scm (logand): Fix range analysis.
2014-07-04 11:58:41 +02:00
Andy Wingo
42b544ebbc Fix range analysis for mul and div
* module/language/cps/types.scm (mul): Avoid producing nans in the
  resulting range.
  (div): Fix range analysis.
2014-07-04 11:14:16 +02:00
Andy Wingo
384d1ec3b2 Type-driven strength reduction
* module/language/cps/type-fold.scm (*primcall-reducers*):
  (define-primcall-reducer, define-unary-primcall-reducer):
  (define-binary-primcall-reducer, mul): Beginnings of strength
  reduction.
  (fold-and-reduce): Rename from compute-folded.
  (fold-constants*): Adapt.
2014-07-04 10:46:31 +02:00
Andy Wingo
c7b71b1fdd Small type-fold cleanup
* module/language/cps/type-fold.scm (fold-constants*): Remove stale
  branches that were there when we only type folded on limited-size
  branches.
2014-07-04 09:18:36 +02:00
Eli Zaretskii
9235f805fa Fix problems with Windows file names that use backslashes.
* libguile/load.c (scm_i_mirror_backslashes): New function.
  (scm_init_load_path): Call it to produce MS-Windows file names
  with forward slashes.
  (FILE_NAME_SEPARATOR_STRING): Define as "/" on all platforms.

* libguile/load.h (scm_i_mirror_backslashes): Add prototype.

* libguile/init.c (scm_boot_guile): Call scm_i_mirror_backslashes
  on argv[0].

* libguile/filesys.c (scm_getcwd): Call scm_i_mirror_backslashes
  on the directory name returned by getcwd.

* test-suite/tests/ports.test ("file name separators"): New test.
2014-07-03 20:58:19 +03:00
Eli Zaretskii
317f6a2370 Unconditionally build and test the ice-9/popen module.
* module/Makefile.am (ICE_9_SOURCES): Add ice-9/popen.scm.
  (ICE_9_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition
  of ice-9/popen.scm.
  (SCRIPTS_SOURCES): Add scripts/autofrisk.scm and
  scripts/scan-api.scm unconditionally.
  (SCRIPTS_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition
  of scripts/autofrisk.scm and scripts/scan-api.scm.

* configure.ac: Remove the BUILD_ICE_9_POPEN condition.

* test-suite/tests/popen.test (if-supported): Don't test for 'fork
 feature being supported.
2014-07-03 19:20:00 +03:00
Andy Wingo
d613ccaaa0 Compiler emits br-if-logtest
* module/language/cps/compile-bytecode.scm (compile-fun):
* module/language/cps/primitives.scm (*branching-primcall-arities*):
* module/language/cps/type-fold.scm (logtest):
* module/language/cps/types.scm (logtest):
* module/system/vm/assembler.scm (system):
* module/system/vm/disassembler.scm (compute-labels): Add backend
  support for the logtest instruction.
2014-07-03 15:03:40 +02:00
Andy Wingo
8c6206f319 Add br-if-logtest opcode
* libguile/vm-engine.c (br-if-logtest): New opcode.
* module/system/vm/disassembler.scm (code-annotation): Add branch
  annotation support.
2014-07-03 14:50:50 +02:00
Andy Wingo
8006d2d6eb Optimizer support for logtest and logbit?
* module/language/cps/effects-analysis.scm: Add entries for logtest and
  logbit?.
* module/language/cps/types.scm (logtest, logbit?): New checkers and
  inferrers.
* module/language/tree-il/peval.scm (peval): Convert (zero? (logand a
  b)) to (logtest a b), in anticipation of opcode support for logtest.
*
  module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*): Add logtest and logbit?.
2014-07-03 14:45:12 +02:00
Andy Wingo
5ded849813 Convert slot allocation to use intsets
* module/language/cps/dfg.scm (compute-live-variables): Convert to use
  intsets, and fold in compute-maximum-fixed-point.
  (print-dfa): Update.

* module/language/cps/slot-allocation.scm (dead-after-def?)
  (dead-after-use?, allocate-slots): Convert to use intsets.
2014-07-03 11:24:37 +02:00
Andy Wingo
7f6aafa5ae Add bitvector->intset.
* module/language/cps/intset.scm (bitvector->intset): New interface.
2014-07-03 10:37:20 +02:00
Andy Wingo
4296c36ec8 Restrict intsets and maps to non-negative integers
* module/language/cps/intmap.scm (intmap-add):
* module/language/cps/intset.scm (intset-add): Restrict to only hold
  non-negative integers.
2014-07-03 09:37:30 +02:00
Andy Wingo
e9808c14d7 Adapt visit-prompt-control-flow to use intsets.
* module/language/cps/dfg.scm (compute-reachable): Use intsets.
  (compute-interval): Adapt.
  (visit-prompt-control-flow): Adapt.
2014-07-03 09:20:11 +02:00
Andy Wingo
c1a41f96b4 CSE comments
* module/language/cps/cse.scm (compute-available-expressions): Add
  clarifying comment.
2014-07-03 09:03:45 +02:00
Andy Wingo
41296769c7 Add intset-subtract.
* module/language/cps/intset.scm (intset-subtract): New interface.
2014-07-03 09:03:12 +02:00
Andy Wingo
93e838423c Fix intset on 32-bit machines
* module/language/cps/intset.scm (*leaf-bits*): Define to 4 on 32-bit
  machines, to stay in fixnum range.
2014-07-01 11:30:29 +02:00
Andy Wingo
0ad455ca6b Remove size limit in elide-type-checks
* module/language/cps/dce.scm (elide-type-checks!): Remove limit on
  label-count, now that complexity is under control.
2014-06-30 15:30:39 +02:00
Andy Wingo
e21dae43fc Fix intmap-intersect corner case
* module/language/cps/intmap.scm (intmap-intersect): Fix a corner case,
  as was recently fixed for intsets.
2014-06-29 19:49:49 +02:00
Andy Wingo
072b5a277c CSE truth inference pass uses intsets
* module/language/cps/cse.scm (compute-truthy-expressions): Rewrite to
  use intsets instead of bitvectors.
  (apply-cse): Adapt.
2014-06-29 19:47:38 +02:00
Andy Wingo
793ca4c433 Result of intsect-intersect will share structure with A if it can
* module/language/cps/intset.scm (intset-intersect): Ensure that the
  result shares structure with A if possible, as intmaps do.
2014-06-29 19:47:38 +02:00
Andy Wingo
257db78b6b Fix an intset-intersect corner case
* module/language/cps/intset.scm (intset-intersect): Avoid creating
  invalid intsets when lowering an intset with a higher shift.
2014-06-29 19:41:16 +02:00
Andy Wingo
b5cb1c77ff Fix intset pruning for empty intsets
* module/language/cps/intset.scm (make-intset/prune): Fix empty intset
  case.
2014-06-29 19:31:41 +02:00
Andy Wingo
2c02a21023 Remove namesets.
This was a failed experiment.  It had good space complexity but terrible
time complexity.

* module/Makefile.am: Update.
* module/language/cps/nameset.scm: Remove.
2014-06-29 14:30:34 +02:00
Andy Wingo
3a12f2ce0b Rewrite type inference to use intmaps
* module/language/cps/types.scm: Rewrite to use intmaps instead of
  namesets.
2014-06-29 14:30:34 +02:00
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
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
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