diff options
| author | Dmitry Antipov | 2014-09-15 18:53:23 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-09-15 18:53:23 +0400 |
| commit | edb0288b83b45d295df52ce7644e897613358971 (patch) | |
| tree | 8f169c257e9752ca860764cc19ec232d287eb189 /src/lisp.h | |
| parent | 497daa12743ed71a70e41f966631d1c8856248cc (diff) | |
| download | emacs-edb0288b83b45d295df52ce7644e897613358971.tar.gz emacs-edb0288b83b45d295df52ce7644e897613358971.zip | |
If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
* lisp.h (local_cons, local_list1, local_list2, local_list3)
[USE_LOCAL_ALLOCATORS]: New macros.
[!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
(build_local_string): Avoid argument name expansion clash with
make_local_string.
* alloc.c (toplevel)
[USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
Preprocessor guard to avoid impossible configuration.
* charset.c (Ffind_charset_region, Ffind_charset_string):
Use make_local_vector.
* lread.c (read1, substitute_object_recurse): Use scoped_cons.
* textprop.c (Fput_text_property, Fadd_face_text_property):
Use scoped_list2.
(copy_text_properties): Use local_cons and local_list3.
* chartab.c (uniprop_table):
* data.c (wrong_choice, wrong_range):
* doc.c (get_doc_string):
* editfns.c (format2):
* fileio.c (Fexpand_file_name, auto_save_error):
* fns.c (Fyes_or_no_p):
* font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
* fontset.c (Fset_fontset_font):
* keyboard.c (echo_add_key, echo_dash, parse_menu_item)
(read_char_minibuf_menu_prompt):
* keymap.c (silly_event_symbol_error, describe_vector):
* menu.c (single_menu_item):
* minibuf.c (Fread_buffer):
* process.c (status_message, Fformat_network_address)
(server_accept_connection): Use make_local_string and
build_local_string. Prefer compound literals where appropriate.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lisp.h b/src/lisp.h index ba3c812f5d8..1a6c69559ce 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4605,6 +4605,20 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons)); | |||
| 4605 | 4605 | ||
| 4606 | # define USE_LOCAL_ALLOCATORS | 4606 | # define USE_LOCAL_ALLOCATORS |
| 4607 | 4607 | ||
| 4608 | /* Return a function-scoped cons whose car is X and cdr is Y. */ | ||
| 4609 | |||
| 4610 | # define local_cons(x, y) \ | ||
| 4611 | ({ \ | ||
| 4612 | struct Lisp_Cons *c = alloca (sizeof (struct Lisp_Cons)); \ | ||
| 4613 | c->car = (x); \ | ||
| 4614 | c->u.cdr = (y); \ | ||
| 4615 | make_lisp_ptr (c, Lisp_Cons); \ | ||
| 4616 | }) | ||
| 4617 | |||
| 4618 | # define local_list1(x) local_cons (x, Qnil) | ||
| 4619 | # define local_list2(x, y) local_cons (x, local_list1 (y)) | ||
| 4620 | # define local_list3(x, y, z) local_cons (x, local_list2 (y, z)) | ||
| 4621 | |||
| 4608 | /* Return a function-scoped vector of length SIZE, with each element | 4622 | /* Return a function-scoped vector of length SIZE, with each element |
| 4609 | being INIT. */ | 4623 | being INIT. */ |
| 4610 | 4624 | ||
| @@ -4643,12 +4657,17 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons)); | |||
| 4643 | 4657 | ||
| 4644 | /* Return a function-scoped string with contents DATA. */ | 4658 | /* Return a function-scoped string with contents DATA. */ |
| 4645 | 4659 | ||
| 4646 | # define build_local_string(data) \ | 4660 | # define build_local_string(data) \ |
| 4647 | ({ char const *data_ = data; make_local_string (data_, strlen (data_)); }) | 4661 | ({ char const *data1_ = (data); \ |
| 4662 | make_local_string (data1_, strlen (data1_)); }) | ||
| 4648 | 4663 | ||
| 4649 | #else | 4664 | #else |
| 4650 | 4665 | ||
| 4651 | /* Safer but slower implementations. */ | 4666 | /* Safer but slower implementations. */ |
| 4667 | # define local_cons(car, cdr) Fcons (car, cdr) | ||
| 4668 | # define local_list1(x) list1 (x) | ||
| 4669 | # define local_list2(x, y) list2 (x, y) | ||
| 4670 | # define local_list3(x, y, z) list3 (x, y, z) | ||
| 4652 | # define make_local_vector(size, init) Fmake_vector (make_number (size), init) | 4671 | # define make_local_vector(size, init) Fmake_vector (make_number (size), init) |
| 4653 | # define make_local_string(data, nbytes) make_string (data, nbytes) | 4672 | # define make_local_string(data, nbytes) make_string (data, nbytes) |
| 4654 | # define build_local_string(data) build_string (data) | 4673 | # define build_local_string(data) build_string (data) |