emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects):


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects): Describe this feature.
Date: Tue, 30 Sep 2014 15:35:33 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117987
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-30 19:35:16 +0400
message:
  * internals.texi (Stack-allocated Objects): Describe this feature.
modified:
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/internals.texi     
internals.texi-20091113204419-o5vbwnq5f7feedwu-6188
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2014-09-15 00:43:29 +0000
+++ b/doc/lispref/ChangeLog     2014-09-30 15:35:16 +0000
@@ -1,3 +1,7 @@
+2014-09-30  Dmitry Antipov  <address@hidden>
+
+       * internals.texi (Stack-allocated Objects): Describe this feature.
+
 2014-09-15  Daniel Colascione  <address@hidden>
 
        * text.texi (Registers): Make `insert-register' documentation

=== modified file 'doc/lispref/internals.texi'
--- a/doc/lispref/internals.texi        2014-07-11 12:49:49 +0000
+++ b/doc/lispref/internals.texi        2014-09-30 15:35:16 +0000
@@ -14,6 +14,7 @@
 * Building Emacs::      How the dumped Emacs is made.
 * Pure Storage::        Kludge to make preloaded Lisp functions shareable.
 * Garbage Collection::  Reclaiming space for Lisp objects no longer used.
+* Stack-allocated Objects::    Temporary conses and strings on C stack.
 * Memory Usage::        Info about total size of Lisp objects made so far.
 * C Dialect::           What C variant Emacs is written in.
 * Writing Emacs Primitives::   Writing C code for Emacs.
@@ -529,6 +530,31 @@
 floating-point number.
 @end defvar
 
address@hidden Stack-allocated Objects
address@hidden Stack-allocated Objects
+
address@hidden stack allocation overview
+  The garbage collector described above is used to manage data visible
+from Lisp program, as well as the most of data internally used by the
+interpreter.  But sometimes it may be useful to allocate temporary
+internal (i.e. not visible for Lisp program) objects using C stack of
+an interpreter.  Currently conses and strings are the only objects which
+can be allocated in that way.  Strings are limited to ASCII characters
+only and should be treated as immutable (calling @code{ASET} on them is
+undefined).
+
address@hidden stack allocation internals
+  In C, this is implemented as a special macros which expands to
+a @code{Lisp_Object} with block-scoped semantics and lifetime (see
+the code around @code{USE_STACK_LISP_OBJECTS} in @file{lisp.h}).  This
+means that these objects are not managed by the garbage collector;
+instead, they are allocated like local variables in C and automatically
+freed when an execution reaches an end of the corresponding scope.  Thus,
+allocation and freeing are faster than using garbage collector.  But
+remember that passing them out of their scope results in undefined
+behavior.  Think twice before using this feature and carefully debug
+your code with @code{GC_CHECK_MARKED_OBJECTS} (see @file{alloc.c}).
+
 @node Memory Usage
 @section Memory Usage
 @cindex memory usage


reply via email to

[Prev in Thread] Current Thread [Next in Thread]