There are two goals: one, to use less memory per dynamic state in order
to allow millions of dynamic states to be allocated in light-weight
threading scenarios. The second goal is to prevent dynamic states from
being actively mutated in two threads at once. This second goal does
mean that dynamic states object that escape into scheme are now copies
that won't receive further updates; an incompatible change, but one
which we hope doesn't affect anyone.
* libguile/cache-internal.h: New file.
* libguile/fluids.c (is_dynamic_state, get_dynamic_state)
(save_dynamic_state, restore_dynamic_state, add_entry)
(copy_value_table): New functions.
(scm_i_fluid_print, scm_i_dynamic_state_print): Move up.
(new_fluid): No need for a number.
(scm_fluid_p: scm_is_fluid): Inline IS_FLUID uses.
(fluid_set_x, fluid_ref): Adapt to dynamic state changes.
(scm_fluid_set_x, scm_fluid_unset_x): Call fluid_set_x.
(scm_swap_fluid): Rewrite in terms of fluid_ref and fluid_set.
(swap_fluid): Use internal fluid_set_x.
(scm_i_make_initial_dynamic_state): Adapt to dynamic state
representation change.
(scm_dynamic_state_p, scm_is_dynamic_state): Use new accessors.
(scm_current_dynamic_state): Use make_dynamic_state.
(scm_dynwind_current_dynamic_state): Use new accessor.
* libguile/fluids.h: Remove internal definitions. Add new struct
definition.
* libguile/threads.h (scm_i_thread): Use scm_t_dynamic_state for dynamic
state.
* libguile/threads.c (guilify_self_1, guilify_self_2):
(scm_i_init_thread_for_guile, scm_init_guile):
(scm_call_with_new_thread):
(scm_init_threads, scm_init_threads_default_dynamic_state): Adapt to
scm_i_thread change.
(scm_i_with_guile, with_guile): Remove "and parent" suffix.
(scm_i_reset_fluid): Remove unneeded function.
* doc/ref/api-scheduling.texi (Fluids and Dynamic States): Remove
scm_make_dynamic_state docs. Update current-dynamic-state docs.
* libguile/vm-engine.c (vm_engine): Update fluid-ref and fluid-set!
inlined fast paths for dynamic state changes.
* libguile/vm.c (vm_error_unbound_fluid): Remove now-unused function.
* NEWS: Update.
* module/ice-9/deprecated.scm (make-dynamic-state): New definition.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_dynamic_state): Move here.
* libguile/__scm.h (scm_t_dynamic_state): New typedef.
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_push_fluid):
(scm_dynstack_unwind_fluid): Take raw dynstate in these internal
functions.
* libguile/throw.c (catch): Adapt to dynstack changes.
There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.
Conflicts:
libguile/deprecated.h
module/ice-9/deprecated.scm
* libguile/__scm.h:
* libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here
from __scm.h.
* libguile/feature.c:
* module/ice-9/deprecated.scm (char-code-limit): Move definition here.
* test-suite/tests/regexp.test: Update to not use char-code-limit.
This commit removes code that was newly deprecated in stable-2.0.
Conflicts:
libguile/deprecated.c
libguile/deprecated.h
libguile/modules.c
module/ice-9/boot-9.scm
module/ice-9/deprecated.scm
* module/ice-9/deprecated.scm: Add alias for $expt. $expt was removed
in commit 6fc4d0124d but no deprecated
alias was added in ad79736c68 like for
all the other deprecated $sin, $cos, ... functions.
* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines
that were not previously issuing warnings were changed so that their
expansions would indicate the replacement forms to use,
e.g. scm_sizet__GONE__REPLACE_WITH__size_t.
The two exceptions were SCM_LISTN, which did not produce warnings
before, and the string-filter argument order stuff.
Drops the initial dirty memory usage of Guile down to 2.8 MB on my
machine, from 4.4 MB.
This allows customizing the reader behavior for a dynamic extent more easily.
* libguile/read.c (scm_read_hash_procedures): Renamed to
`scm_i_read_hash_procedures'.
(scm_i_read_hash_procedures_ref, scm_i_read_hash_procedures_set_x):
New (internal) accessor functions for the fluid.
(scm_read_hash_extend, scm_get_hash_procedure): Use these accessor
functions.
(scm_init_read): Create the fluid, named `%read-hash-procedures' instead of
the previous plain list `read-hash-procedures'.
* test-suite/tests/reader.test: Adapt the "R6RS/SRFI-30 block comment
syntax overridden" test to make use of the fluid.
* module/ice-9/deprecated.scm (read-hash-procedures):
New identifier macro -- backward-compatibility shim.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/ice-9/boot-9.scm (module-ref-submodule)
(module-define-submodule!): Pull deprecated shims here, as we need
them before loading (ice-9 deprecated). Also bugfix to only define the
module if there is no local variable, even if it is unbound.
* module/ice-9/deprecated.scm: Remove from here.
* module/ice-9/boot-9.scm (*repl-stack*): Instead of repl-level, have a
stack.
(batch-mode?): Change to poke the stack.
* module/ice-9/deprecated.scm (set-batch-mode?!): Update deprecation
method.
* module/system/repl/common.scm (repl-prompt): Update to poke
*repl-stack* to get the level.
* module/system/repl/repl.scm (start-repl): Bind *repl-stack*
appropriately.
* libguile/backtrace.h (scm_the_last_stack_fluid_var)
* libguile/backtrace.c (scm_init_backtrace): No more
scm_the_last_stack_fluid_var. The replacement is to resolve
`the-last-stack' in (ice-9 stack-catch).
(scm_backtrace_with_highlights): Accordingly, instead of backtracing
the last stack, backtrace the current stack.
* libguile/throw.h:
* libguile/throw.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_stack_catch): Deprecate this
function.
* module/ice-9/save-stack.scm (the-last-stack): Move here from boot-9.
* module/ice-9/debug.scm:
* module/ice-9/debugger.scm: Use (ice-9 save-stack) for the-last-stack.
* module/ice-9/deprecated.scm (the-last-stack): Add deprecated shim.
* module/ice-9/boot-9.scm:
* module/ice-9/scm-style-repl.scm (handle-system-error): Move here from
boot-9.
* module/ice-9/deprecated.scm (handle-system-error): Keep a deprecated
wrapper in the root environment.
* module/ice-9/boot-9.scm (*repl-level*): New global fluid, moved here
from (system repl common).
(batch-mode?): Reimplement in terms of *repl-level*.
(ensure-batch-mode!): A replacement for set-batch-mode?!.
* module/ice-9/deprecated.scm (set-batch-mode?!): Deprecate.
* module/ice-9/popen.scm (open-process): Use ensure-batch-mode!.
* module/ice-9/scm-style-repl.scm (error-catching-loop): Override
ensure-batch-mode!.
* module/system/repl/common.scm: Remove *repl-level*.
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (set-repl-prompt!): Deprecate, but wrap
the (system repl common) implementation instead of the scm-style-repl.
* module/ice-9/boot-9.scm:
* module/ice-9/scm-style-repl.scm (scm-repl-silent, assert-repl-silence)
(scm-repl-print-unspecified, assert-repl-print-unspecified)
(scm-repl-verbose, assert-repl-verbosity)
(scm-repl-prompt): Move these definitions here from boot-9.scm.
* module/ice-9/deprecated.scm (assert-repl-silence):
(assert-repl-print-unspecified, assert-repl-verbosity): Deprecated
wrappers for the functions. I'm not sure if the variables can be
helped though.
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (get-option, for-next-option)
(display-usage-report, transform-usage-lambda): Deprecate these
option-parsing utils. We can revive them in a non-deprecated module if
there is interest, but I suspect there will be no interest.
* module/ice-9/boot-9.scm:
* module/ice-9/scm-style-repl.scm (bad-throw): Move here. This function
was never documented, but has been around since guile-ii. It's not
used with current code though.
* module/ice-9/deprecated.scm: Provide bad-throw in default env.
* module/ice-9/debugger/commands.scm: Import bad-throw from
scm-style-repl.
* module/Makefile.am:
* module/ice-9/scm-style-repl.scm: New file, to hold the old
scm-style-repl.
* module/ice-9/deprecated.scm: Provide scm-style-repl and
error-catching-loop and error-catching-repl in the default env, but
with deprecation warnings.
* module/ice-9/boot-9.scm (module-public-interface)
(set-module-public-interface!): Instead of using
'%module-public-interface, use a field in the module instead.
(make-module, make-autoload-interface): Adapt.
* module/ice-9/deprecated.scm (module-public-interface):
(set-module-public-interface!): Add shims so that manually munging
%module-public-interface should continue to work.
* module/ice-9/boot-9.scm (module-submodule-binder)
(set-module-submodule-binder!): New field on modules.
(make-module, make-autoload-interface): Adapt.
(module-ref-submodule): If we miss the submodules table, call the
submodules binder, if any.
* module/ice-9/deprecated.scm (module-ref-submodule): Check the
submodule binder before the deprecated look into the obarray.
* module/ice-9/boot-9.scm (module-ref-submodule)
(module-define-submodule!): Implement in terms of the
module-submodules table, instead of looking for bindings in the value
namespace.
* module/ice-9/deprecated.scm (module-ref-submodule):
(module-define-submodule!): Define deprecated versions of these that
duplicate the submodules table in the normal values namespace, for
back compatibility.
* module/ice-9/deprecated.scm (%app, app, modules): Don't use the module
interface to provide %app shims, use module-define-submodule! directly
to side-effect the root module.