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

22 commits

Author SHA1 Message Date
Andy Wingo
b077e807c0 Add nullary intmap and intset folders
* module/language/cps/intmap.scm (intmap-fold, intmap-fold-right):
* module/language/cps/intset.scm (intset-fold, intset-fold-right): Add
  nullary folders.
2017-11-29 19:57:11 +01:00
Andy Wingo
bd2c690901 intmap-remove returns empty-intmap if appropriate
* module/language/cps/intmap.scm (intmap-remove): Return empty-intmap if
  the result is indeed empty.
2017-11-24 10:37:44 +01:00
Andy Wingo
d74e0fed0d Move thread bindings to (ice-9 threads)
* libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs.
* libguile/threads.c (scm_init_ice_9_threads): Rename from
  scm_init_thread_procs, make static.
  (scm_init_threads): Register scm_init_thread_procs extension.
* libguile/threads.h (scm_init_thread_procs): Remove decl.
* module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side
  effects occur early.
* module/ice-9/deprecated.scm (define-deprecated): Fix to allow
  deprecated bindings to appear in operator position.  Export deprecated
  bindings.
  (define-deprecated/threads, define-deprecated/threads*): Trampoline
  thread bindings to (ice-9 threads).
* module/ice-9/futures.scm: Use ice-9 threads.
* module/ice-9/threads.scm: Load scm_init_ice_9_threads extension.
  Reorder definitions and imports so that the module circularity
  with (ice-9 futures) continues to work.
* module/language/cps/intmap.scm:
* module/language/cps/intset.scm:
* module/language/tree-il/primitives.scm: Use (ice-9 threads).
* module/language/cps/reify-primitives.scm: Reify current-thread
  in (ice-9 threads) module.
* module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and
  adapt all users.  Use proper keywords in module definition form.
* test-suite/tests/filesys.test (test-suite):
* test-suite/tests/fluids.test (test-suite):
* test-suite/tests/srfi-18.test: Use ice-9 threads.
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Update.
* doc/ref/posix.texi (Processes): Move current-processor-count and
  total-processor-count docs to Threads.
2016-10-23 22:29:44 +02:00
Andy Wingo
3c271457f1 Fix build when threads are disabled
* module/language/cps/intmap.scm: Remove srfi-18 import.  We just need
  current-thread which is actually defined in (guile), and
  importing (srfi srfi-18) raises an error if Guile is compiled without
  threads support.
2015-12-16 09:48:37 +00:00
Andy Wingo
1850497a5c Fix intmap-ref bug
* module/language/cps/intmap.scm (intmap-ref): Fix a case in which the
  not-found procedure could be called with an incorrect value.
2015-06-05 00:34:05 +02:00
Andy Wingo
8b4a523ad5 Add intmap-fold-right
* module/language/cps/intmap.scm (make-intmap-folder): Add forward? argument.
  (intmap-fold): Adapt.
  (intmap-fold-right): New function.
2015-06-02 10:05:10 +02:00
Andy Wingo
23379467ae Add intmap-replace!.
* module/language/cps/intmap.scm (intmap-replace!): New interface.

* module/language/cps2/dce.scm (elide-type-checks):
* module/language/cps2/simplify.scm (transform-conts):
* module/language/cps2/utils.scm (intmap-map):
* module/language/tree-il/compile-cps2.scm (cps-convert/thunk): Use intmap-replace!.
2015-06-02 10:05:09 +02:00
Andy Wingo
8f578af0bb Add intmap-replace.
* module/language/cps/intmap.scm (intmap-replace): New interface.
2015-06-02 10:05:09 +02:00
Andy Wingo
102e677b98 intmaps and intsets print with abbreviated key ranges
* module/language/cps/intset.scm (intset-key-ranges, range-string):
  (print-helper, print-intset, print-transient-intset): New helpers.
  Install as intset printers.
* module/language/cps/intmap.scm (intmap-key-ranges, range-string):
  (print-helper): New helpers.
  (print-intmap, print-transient-intmap): Call the new helpers.
2015-05-20 19:18:45 +02:00
Andy Wingo
5f7c8e5cb3 Variadic intset-fold, intmap-fold
* module/language/cps/intmap.scm (intmap-fold): Add two-seeded arity.
* module/language/cps/intset.scm (intset-fold): Merge intset-fold2
  into this function, as a two-seeded arity.

* module/language/cps2/simplify.scm (compute-eta-reductions):
  (compute-singly-referenced-labels, compute-beta-reductions): Adapt
  intset-fold2 callers.
2015-05-20 19:18:45 +02:00
Andy Wingo
2b06e90ca4 Intmaps do not treat #f specially as a value
* module/language/cps/intmap.scm: Intmaps can now contain any value;
  #f does not indicate the absence of a value.  Instead we use a unique
  private sentinel to mark absent values or branches.
  (*absent*, absent?, present?): New helpers.
  (new-branch): Initialize empty elements to *absent*.
  (clone-branch-with-edit): New helper.
  (clone-branch-and-set): Use clone-branch-with-edit.
  (writable-branch): Use clone-branch-with-edit
  (empty-intmap): Initialize value to *absent*.
  (add-level): clone-branch-and-set doesn't take #f as a branch any
  more; use new-branch.
  (branch-empty?, make-intmap/prune, intmap-add!):
  (intmap-add, intmap-remove, intmap-next, intmap-prev):
  (intmap-fold, intmap-union, intmap-intersect): Use absent? to detect
  absent branches / values.
  (intmap-ref): Likewise.  Instead of returning #f if the value is not
  found, call the optional not-found procedure.  By default this will
  signal an error.

* module/language/cps/types.scm:
* module/language/cps2/renumber.scm:
* module/language/cps2/simplify.scm: Adapt to intmap-ref signalling an
  error by default if the value is not found.

* module/language/tree-il/compile-cps2.scm: Adapt to intmap-add
  signalling an error if #f was in the intmap as a value.
2015-05-20 19:18:45 +02:00
Andy Wingo
0f082bd3f7 Fix intmap-add! transient bug
* module/language/cps/intmap.scm (intmap-add!): Fix a bug creating a
  transient branch out of a persistent branch.
2015-05-08 14:09:40 +02:00
Andy Wingo
6ffb6e69ed Add printers for <intmap> and <transient-intmap>
* module/language/cps/intmap.scm (intmap->alist, print-intmap)
  (print-transient-intmap): New functions.
  Install the new functions as printers for <intmap> and <transient-intmap>.
2015-05-08 11:46:46 +02:00
Andy Wingo
95db570528 Add "transient" intmap interface
* module/language/cps/intmap.scm (make-atomic-reference):
  (get-atomic-reference, set-atomic-reference!): New helpers.
  (*branch-size-with-edit*, *edit-index*): Branches now have a trailing
  field, an atomic reference to their owner.
  (<transient-intmap>): New record type.  A mutable intmap.
  (new-branch): Set the "edit" field on the branch.
  (clone-branch-and-set): No editor for this field.
  (assert-readable!, writable-branch): New helpers.
  (transient-intmap, persistent-intmap): New exported functions.
  (intmap-add!): New function.
  (intmap-next, intmap-prev, intmap-ref): Work on transient intmaps.
  (intmap-fold): Persist the intmap before folding over it.
2015-04-08 17:17:59 +02:00
Andy Wingo
cf512e3268 32-way branching in intmap.scm, not 16-way
* module/language/cps/intmap.scm (*branch-bits*): Switch to 32-way
  branching.  Marginally faster on lookup, and creation costs can be
  amortized via using the transient interface.  Marginal speedup for
  assembler.scm compilation.
2015-04-01 10:53:23 +02:00
Andy Wingo
b7668bd949 Add intmap-fold.
* module/language/cps/intmap.scm (intmap-fold): New function.
2015-04-01 10:53:21 +02:00
Andy Wingo
2a24395a0f Add intmap-prev
* module/language/cps/intmap.scm (intmap-next): Starting index is
  optional.
  (intmap-prev): New function.
2015-04-01 10:28:19 +02:00
Andy Wingo
33ab2838de Default "meet" operator is meet-error for intmap
* module/language/cps/intmap.scm (meet-error): New helper.
  (intmap-add, intmap-union, intmap-intersect): The "meet" argument is
  optional and defaults to meet-error.
2015-04-01 10:28:19 +02:00
Andy Wingo
ef7a71b768 Fix intmap bug for maps with only one element
* module/language/cps/intmap.scm (intmap-ref): Fix bug referencing
  values when there is only one value in the map.
2015-04-01 10:10:10 +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
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
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