1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

add save-restriction support

This commit is contained in:
Andrea Corallo 2019-08-11 14:10:57 +02:00 committed by Andrea Corallo
parent bdadeff503
commit 7dc99d5d51
2 changed files with 22 additions and 5 deletions

View file

@ -642,14 +642,15 @@ the annotation emission."
(byte-save-excursion
(comp-emit '(call record_unwind_protect_excursion)))
(byte-save-window-excursion-OBSOLETE)
(byte-save-restriction)
(byte-catch)
(byte-save-restriction
'(call helper-save-restriction))
(byte-catch) ;; Obsolete
(byte-unwind-protect
(comp-emit `(call helper_unwind_protect ,(comp-slot-next))))
(byte-condition-case)
(byte-condition-case) ;; Obsolete
(byte-temp-output-buffer-setup-OBSOLETE)
(byte-temp-output-buffer-show-OBSOLETE)
(byte-unbind-all)
(byte-unbind-all) ;; Obsolete
(byte-set-marker auto)
(byte-match-beginning auto)
(byte-match-end auto)

View file

@ -165,6 +165,8 @@ Lisp_Object helper_unbind_n (Lisp_Object n);
bool helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a,
enum pvec_type code);
void helper_emit_save_restriction (void);
static char * ATTRIBUTE_FORMAT_PRINTF (1, 2)
format_string (const char *format, ...)
@ -2075,6 +2077,8 @@ DEFUN ("comp-init-ctxt", Fcomp_init_ctxt, Scomp_init_ctxt,
emit_simple_limple_call_lisp_ret);
register_emitter (Qrecord_unwind_protect_excursion,
emit_simple_limple_call_void_ret);
register_emitter (Qhelper_save_restriction,
emit_simple_limple_call_void_ret);
}
comp.ctxt = gcc_jit_context_acquire();
@ -2389,6 +2393,8 @@ DEFUN ("comp-compile-and-load-ctxt", Fcomp_compile_and_load_ctxt,
/******************************************************************************/
/* Helper functions called from the runtime. */
/* These can't be statics till shared mechanism is used to solve relocations. */
/* Note: this are all potentially definable directly to gcc and are here just */
/* for lazyness. Change this if a performance impact is measured. */
/******************************************************************************/
Lisp_Object
@ -2402,7 +2408,8 @@ helper_save_window_excursion (Lisp_Object v1)
return v1;
}
void helper_unwind_protect (Lisp_Object handler)
void
helper_unwind_protect (Lisp_Object handler)
{
/* Support for a function here is new in 24.4. */
record_unwind_protect (FUNCTIONP (handler) ? bcall0 : prog_ignore,
@ -2432,6 +2439,14 @@ helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a,
code);
}
void
helper_emit_save_restriction (void)
{
record_unwind_protect (save_restriction_restore,
save_restriction_save ());
}
void
syms_of_comp (void)
{
@ -2457,6 +2472,7 @@ syms_of_comp (void)
DEFSYM (Qrecord_unwind_protect_excursion, "record_unwind_protect_excursion");
DEFSYM (Qhelper_unbind_n, "helper_unbind_n");
DEFSYM (Qhelper_unwind_protect, "helper_unwind_protect");
DEFSYM (Qhelper_save_restriction, "helper_save_restriction")
defsubr (&Scomp_init_ctxt);
defsubr (&Scomp_release_ctxt);