diff options
| author | Andrea Corallo | 2019-08-11 14:10:57 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:59 +0100 |
| commit | 7dc99d5d51fcadafcd7e38f169ef8b353db61e81 (patch) | |
| tree | d34289ef70edfc95a7e9196c1199be98ae06a9dd /src/comp.c | |
| parent | bdadeff503d1796758a498dee218751520bb0cf8 (diff) | |
| download | emacs-7dc99d5d51fcadafcd7e38f169ef8b353db61e81.tar.gz emacs-7dc99d5d51fcadafcd7e38f169ef8b353db61e81.zip | |
add save-restriction support
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/comp.c b/src/comp.c index 90fa5ccdfa3..a4793a36ada 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -165,6 +165,8 @@ Lisp_Object helper_unbind_n (Lisp_Object n); | |||
| 165 | bool helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a, | 165 | bool helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a, |
| 166 | enum pvec_type code); | 166 | enum pvec_type code); |
| 167 | 167 | ||
| 168 | void helper_emit_save_restriction (void); | ||
| 169 | |||
| 168 | 170 | ||
| 169 | static char * ATTRIBUTE_FORMAT_PRINTF (1, 2) | 171 | static char * ATTRIBUTE_FORMAT_PRINTF (1, 2) |
| 170 | format_string (const char *format, ...) | 172 | format_string (const char *format, ...) |
| @@ -2075,6 +2077,8 @@ DEFUN ("comp-init-ctxt", Fcomp_init_ctxt, Scomp_init_ctxt, | |||
| 2075 | emit_simple_limple_call_lisp_ret); | 2077 | emit_simple_limple_call_lisp_ret); |
| 2076 | register_emitter (Qrecord_unwind_protect_excursion, | 2078 | register_emitter (Qrecord_unwind_protect_excursion, |
| 2077 | emit_simple_limple_call_void_ret); | 2079 | emit_simple_limple_call_void_ret); |
| 2080 | register_emitter (Qhelper_save_restriction, | ||
| 2081 | emit_simple_limple_call_void_ret); | ||
| 2078 | } | 2082 | } |
| 2079 | 2083 | ||
| 2080 | comp.ctxt = gcc_jit_context_acquire(); | 2084 | comp.ctxt = gcc_jit_context_acquire(); |
| @@ -2389,6 +2393,8 @@ DEFUN ("comp-compile-and-load-ctxt", Fcomp_compile_and_load_ctxt, | |||
| 2389 | /******************************************************************************/ | 2393 | /******************************************************************************/ |
| 2390 | /* Helper functions called from the runtime. */ | 2394 | /* Helper functions called from the runtime. */ |
| 2391 | /* These can't be statics till shared mechanism is used to solve relocations. */ | 2395 | /* These can't be statics till shared mechanism is used to solve relocations. */ |
| 2396 | /* Note: this are all potentially definable directly to gcc and are here just */ | ||
| 2397 | /* for lazyness. Change this if a performance impact is measured. */ | ||
| 2392 | /******************************************************************************/ | 2398 | /******************************************************************************/ |
| 2393 | 2399 | ||
| 2394 | Lisp_Object | 2400 | Lisp_Object |
| @@ -2402,7 +2408,8 @@ helper_save_window_excursion (Lisp_Object v1) | |||
| 2402 | return v1; | 2408 | return v1; |
| 2403 | } | 2409 | } |
| 2404 | 2410 | ||
| 2405 | void helper_unwind_protect (Lisp_Object handler) | 2411 | void |
| 2412 | helper_unwind_protect (Lisp_Object handler) | ||
| 2406 | { | 2413 | { |
| 2407 | /* Support for a function here is new in 24.4. */ | 2414 | /* Support for a function here is new in 24.4. */ |
| 2408 | record_unwind_protect (FUNCTIONP (handler) ? bcall0 : prog_ignore, | 2415 | record_unwind_protect (FUNCTIONP (handler) ? bcall0 : prog_ignore, |
| @@ -2433,6 +2440,14 @@ helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a, | |||
| 2433 | } | 2440 | } |
| 2434 | 2441 | ||
| 2435 | void | 2442 | void |
| 2443 | helper_emit_save_restriction (void) | ||
| 2444 | { | ||
| 2445 | record_unwind_protect (save_restriction_restore, | ||
| 2446 | save_restriction_save ()); | ||
| 2447 | } | ||
| 2448 | |||
| 2449 | |||
| 2450 | void | ||
| 2436 | syms_of_comp (void) | 2451 | syms_of_comp (void) |
| 2437 | { | 2452 | { |
| 2438 | /* Limple instruction set. */ | 2453 | /* Limple instruction set. */ |
| @@ -2457,6 +2472,7 @@ syms_of_comp (void) | |||
| 2457 | DEFSYM (Qrecord_unwind_protect_excursion, "record_unwind_protect_excursion"); | 2472 | DEFSYM (Qrecord_unwind_protect_excursion, "record_unwind_protect_excursion"); |
| 2458 | DEFSYM (Qhelper_unbind_n, "helper_unbind_n"); | 2473 | DEFSYM (Qhelper_unbind_n, "helper_unbind_n"); |
| 2459 | DEFSYM (Qhelper_unwind_protect, "helper_unwind_protect"); | 2474 | DEFSYM (Qhelper_unwind_protect, "helper_unwind_protect"); |
| 2475 | DEFSYM (Qhelper_save_restriction, "helper_save_restriction") | ||
| 2460 | 2476 | ||
| 2461 | defsubr (&Scomp_init_ctxt); | 2477 | defsubr (&Scomp_init_ctxt); |
| 2462 | defsubr (&Scomp_release_ctxt); | 2478 | defsubr (&Scomp_release_ctxt); |