* module/ice-9/vlist.scm (make-block): If we are making a hash table,
allocate it inline with the contents. Otherwise don't even add a
pointer to the block.
(block-hash-table?): New internal accessor.
(block-ref*): Remove. Vhash entries are no longer wrapped.
(block-ref):
(block-hash-table-next-offset):
(block-hash-table-set-next-offset!):
(block-hash-table-ref):
(block-hash-table-set!):
(block-hash-table-add!): Adapt to take content vector explicitly, and
to expect the hash table inline with the contents. Some of these
accessors are new. Adapt callers.
(assert-vlist): New helper.
(vlist-cons): Update comment.
(vhash?): Update scheme to allocate the hash table and chain links
inline with the contents.
(%vhash-fold*, %vhash-assoc): Rewrite to be more performant.
* module/ice-9/vlist.scm (set-block-next-free!): Define this instead of
increment-block-next-free!.
(block-append!): Refactor to take an offset, and only append if the
offset is the next free value, and there is space in the block.
(block-cons): Refactor to not be a loop. The partial evaluator would
have to understand effects analysis in order to be able to unroll it,
and there's at most one recursion.
Recovers the performance loss resulting from the previous commit.
* module/ice-9/vlist.scm: Use define-inlinable instead of define-inline,
to ensure strict argument evaluation. There is a slight performance
penalty, but I hope subsequent hacks make it up.
* doc/ref/api-compound.texi (VHashes): Add missing `init' parameter in
documentation for vhash-fold and vhash-fold-right, and also improve
description.
* module/ice-9/vlist.scm (vhash-fold, vhash-fold-right): Rename formal
parameter `seed' to `init', to match documentation. Improve
docstrings.
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
default value in the dynamic-state vector to be SCM_UNDEFINED instead
of SCM_BOOL_F. If the value in the dynamic-state is #f, default to a
value attached to the fluid instead. This allows useful default
values.
(scm_make_fluid_with_default): New function, allows the user to
specify a default value for the fluid. Defaults to #f. Bound to
`make-fluid' on the Scheme side.
(scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
threads.
(scm_fluid_unset_x): Also unset the default value. Not sure if this
is the right thing.
(fluid_ref): Update to the new default-value strategy.
* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
strategy.
* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
threads. Fixes http://debbugs.gnu.org/10093.
* module/ice-9/vlist.scm (vlist-fold-right): Avoid `vlist-reverse' and
instead `vlist-ref' individual elements. The result is about twice
faster. Thanks Andy for suggesting it indirectly. :-)