* 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.
* 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.
* 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>.
* 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.
* 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.
* 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.