aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-06-07 18:53:26 -0700
committerPaul Eggert2018-06-07 19:11:49 -0700
commit7c16392ccae50fe09ca3cbb11cc2cd59e5c376cc (patch)
tree377b8f207507b9389269879ac1622fe44d26f97f /src
parent9966842a2166d42cb6969b6bbc5154960d1252bc (diff)
downloademacs-7c16392ccae50fe09ca3cbb11cc2cd59e5c376cc.tar.gz
emacs-7c16392ccae50fe09ca3cbb11cc2cd59e5c376cc.zip
Fix GC-related commentary
* src/lisp.h: USE_STACK_LISP_OBJECTS is no longer experimental. Also, remove confusion about scope vs lifetime. And say that stack-allocated strings should not be given text properties.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lisp.h b/src/lisp.h
index ee2e72d32b7..c5af4fa6c75 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -228,7 +228,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
228 228
229 USE_LSB_TAG not only requires the least 3 bits of pointers returned by 229 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
230 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment 230 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
231 on the few static Lisp_Objects used, all of which are aligned via 231 on some non-GC Lisp_Objects, all of which are aligned via
232 'char alignas (GCALIGNMENT) gcaligned;' inside a union. */ 232 'char alignas (GCALIGNMENT) gcaligned;' inside a union. */
233 233
234enum Lisp_Bits 234enum Lisp_Bits
@@ -4680,13 +4680,14 @@ extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1));
4680#define SAFE_ALLOCA_LISP(buf, nelt) SAFE_ALLOCA_LISP_EXTRA (buf, nelt, 0) 4680#define SAFE_ALLOCA_LISP(buf, nelt) SAFE_ALLOCA_LISP_EXTRA (buf, nelt, 0)
4681 4681
4682 4682
4683/* If USE_STACK_LISP_OBJECTS, define macros that and functions that allocate 4683/* If USE_STACK_LISP_OBJECTS, define macros and functions that
4684 block-scoped conses and strings. These objects are not 4684 allocate some Lisp objects on the C stack. As the storage is not
4685 managed by the garbage collector, so they are dangerous: passing them 4685 managed by the garbage collector, these objects are dangerous:
4686 out of their scope (e.g., to user code) results in undefined behavior. 4686 passing them to user code could result in undefined behavior if the
4687 Conversely, they have better performance because GC is not involved. 4687 objects are in use after the C function returns. Conversely, these
4688 objects have better performance because GC is not involved.
4688 4689
4689 This feature is experimental and requires careful debugging. 4690 While debugging you may want to disable allocation on the C stack.
4690 Build with CPPFLAGS='-DUSE_STACK_LISP_OBJECTS=0' to disable it. */ 4691 Build with CPPFLAGS='-DUSE_STACK_LISP_OBJECTS=0' to disable it. */
4691 4692
4692#if (!defined USE_STACK_LISP_OBJECTS \ 4693#if (!defined USE_STACK_LISP_OBJECTS \
@@ -4751,7 +4752,8 @@ enum
4751 Take its unibyte value from the null-terminated string STR, 4752 Take its unibyte value from the null-terminated string STR,
4752 an expression that should not have side effects. 4753 an expression that should not have side effects.
4753 STR's value is not necessarily copied. The resulting Lisp string 4754 STR's value is not necessarily copied. The resulting Lisp string
4754 should not be modified or made visible to user code. */ 4755 should not be modified or given text properties or made visible to
4756 user code. */
4755 4757
4756#define AUTO_STRING(name, str) \ 4758#define AUTO_STRING(name, str) \
4757 AUTO_STRING_WITH_LEN (name, str, strlen (str)) 4759 AUTO_STRING_WITH_LEN (name, str, strlen (str))
@@ -4760,7 +4762,8 @@ enum
4760 Take its unibyte value from the null-terminated string STR with length LEN. 4762 Take its unibyte value from the null-terminated string STR with length LEN.
4761 STR may have side effects and may contain null bytes. 4763 STR may have side effects and may contain null bytes.
4762 STR's value is not necessarily copied. The resulting Lisp string 4764 STR's value is not necessarily copied. The resulting Lisp string
4763 should not be modified or made visible to user code. */ 4765 should not be modified or given text properties or made visible to
4766 user code. */
4764 4767
4765#define AUTO_STRING_WITH_LEN(name, str, len) \ 4768#define AUTO_STRING_WITH_LEN(name, str, len) \
4766 Lisp_Object name = \ 4769 Lisp_Object name = \