• Stefan Monnier's avatar
    Rely on conservative stack scanning to find "emacs_value"s · 3eb93c07
    Stefan Monnier authored
    * src/emacs-module.c (struct emacs_value_tag)
    (struct emacs_value_frame, struct emacs_value_storage): Remove.
    (value_frame_size): Remove constant.
    (struct emacs_env_private): Use Lisp_Object for non_local_exit info.
    (lisp_to_value): Remove first arg.
    (module_nil): New constant.
    Use it instead of NULL when returning an emacs_value.
    (module_make_function): Adjust to new calling convention of
    Qinternal_module_call.
    (DEFUN): Receive args in an array rather than a list.
    Use SAFE_ALLOCA rather than xnmalloc.  Skip the lisp_to_value loop when
    we don't have WIDE_EMACS_INT.  Adjust to new type of non_local_exit info.
    (module_non_local_exit_signal_1, module_non_local_exit_throw_1):
    Adjust to new type of non_local_exit info.
    (ltv_mark) [WIDE_EMACS_INT]: New constant.
    (value_to_lisp, lisp_to_value): Rewrite.
    (initialize_frame, initialize_storage, finalize_storage): Remove functions.
    (allocate_emacs_value): Remove function.
    (mark_modules): Gut it.
    (initialize_environment): Don't initialize storage any more.
    Keep the actual env object on Vmodule_environments.
    (finalize_environment): Don't finalize storage any more.
    (syms_of_module): Initialize ltv_mark and module_nil.
    
    * src/emacs-module.h (emacs_value): Make it more clear that this type
    is really opaque, including the fact that NULL may not be valid.
    
    * modules/mod-test/mod-test.c (Fmod_test_signal, Fmod_test_throw):
    Don't assume that NULL is a valid emacs_value.
    3eb93c07
mod-test.c 7.72 KB