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

17263 commits

Author SHA1 Message Date
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
3ddd438179 maybe_annotate_source does not annotate negative positions
* libguile/read.c (maybe_annotate_source): Don't annotate with negative
  lines or columns.
2014-07-21 21:38:17 +02:00
Andy Wingo
3c01acbcf5 Soft port fill-input doesn't alter line or column
* libguile/vports.c (sf_fill_input): Save and restore the line/column
  info around the ungetc.
2014-07-21 21:38:16 +02:00
Andy Wingo
681f2b8585 scm_ungetc_unlocked should not result in negative columns
* libguile/ports.c (scm_ungetc_unlocked): Use DECCOL in all cases, to
  avoid negative columns.
2014-07-21 21:38:16 +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
Andy Wingo
d40752513f 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-07-04 16:52:29 +02:00
Ludovic Courtès
f184e887a6 build: Support pthread builds without 'pthread_cancel' support (Android).
Reported by Sylvain Beucler <beuc@beuc.net>.

* configure.ac: Check for 'pthread_cancel'.
* libguile/threads.c (scm_cancel_thread): Conditionalize on
  !SCM_USE_PTHREAD_THREADS || defined HAVE_PTHREAD_CANCEL.
* test-suite/tests/threads.test (require-cancel-thread): New procedure.
  ("timed joining fails if timeout exceeded", "join-thread returns
  timeoutval on timeout", "cancel succeeds", "handler result passed to
  join", "can cancel self"): Use it.
2014-07-04 15:52:53 +02:00
Ludovic Courtès
8c75d3ae01 build: Use 'LT_LIB_M' to determine whether -lm is needed.
* configure.ac: Use 'LT_LIB_M' instead of 'AC_CHECK_LIB(m, cos)'.
  Suggested by Sylvain Beucler <beuc@beuc.net>.
2014-07-04 15:37:38 +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
c53b5d891f Remove trailing whitespace from ports.test. 2014-07-03 21:05:49 +03:00
Eli Zaretskii
8c6b62e7d5 Untabify some test files.
* test-suite/tests/ports.test: Untabify.
* test-suite/tests/posix.test: Untabify.
* test-suite/tests/r6rs-files.test: Untabify.
2014-07-03 21:02:23 +03: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
9dc3fc4dd4 Fix calculation of CPU set size for getaffinity.
* libguile/posix.c (cpu_set_to_bitvector): Use CPU_SETSIZE, not
  sizeof, to compute the size of the CPU set.
2014-07-03 19:30:02 +03:00
Eli Zaretskii
5102fc3790 Provide a more reasonable default value for stack limit on MS-Windows.
* libguile/debug.c (init_stack_limit) [__MINGW32__]: Use
  VirtualQuery to compute the stack limit on MS-Windows.
2014-07-03 19:26:21 +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
Eli Zaretskii
bc945fadd2 More fixes for deleting files whose ports are not closed.
* test-suite/tests/r6rs-files.test: Close the port after
	using it.

	* test-suite/tests/posix.test ("mkstemp!"): Close the port after
	using it.
2014-07-02 21:21:52 +03:00
Eli Zaretskii
4698a11cbd Make 'system*' available on MS-Windows.
* libguile/simpos.c (scm_system_star) [!HAVE_FORK]: An
	implementation of 'system*' for MS-Windows, which doesn't have
	'fork', but can use 'spawnvp' in this case.
2014-07-02 18:38:28 +03:00
Eli Zaretskii
0d77e062dc Fix deletion of ports.test test file on MS-Windows.
* test-suite/tests/ports.test ("fdes->port", "seek")
	("truncate-file"): Close every file and port we open, to avoid
	failure to delete the test file on MS-Windows when the test is
	completed.
2014-07-02 18:28:06 +03: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