emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117847: Cleanup last change and make all new stuff


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117847: Cleanup last change and make all new stuff conditional.
Date: Tue, 09 Sep 2014 11:43:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117847
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-09 15:43:22 +0400
message:
  Cleanup last change and make all new stuff conditional.
  * lisp.h (build_local_string): Rename to ...
  (make_local_string): ... this macro.
  (build_local_string, scoped_list1, scoped_list3): New macros.
  (toplevel) [USE_STACK_LISP_OBJECTS]: Define all new macros
  and functions as such, use regular fallbacks otherwise.
  * alloc.c (verify_alloca) [USE_STACK_LISP_OBJECTS]: Define
  conditionally.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-09 03:44:06 +0000
+++ b/src/ChangeLog     2014-09-09 11:43:22 +0000
@@ -17,6 +17,15 @@
        * alloc.c (verify_alloca) [ENABLE_CHECKING]: New function.
        (init_alloc_once): Call it.
 
+       Cleanup last change and make all new stuff conditional.
+       * lisp.h (build_local_string): Rename to ...
+       (make_local_string): ... this macro.
+       (build_local_string, scoped_list1, scoped_list3): New macros.
+       (toplevel) [USE_STACK_LISP_OBJECTS]: Define all new macros
+       and functions as such, use regular fallbacks otherwise.
+       * alloc.c (verify_alloca) [USE_STACK_LISP_OBJECTS]: Define
+       conditionally.
+
 2014-09-08  Eli Zaretskii  <address@hidden>
 
        * dispnew.c (prepare_desired_row): When MODE_LINE_P is zero,

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2014-09-09 03:44:06 +0000
+++ b/src/alloc.c       2014-09-09 11:43:22 +0000
@@ -7118,6 +7118,10 @@
   terminate_due_to_signal (SIGABRT, INT_MAX);
 }
 
+#endif /* ENABLE_CHECKING */
+
+#if defined (ENABLE_CHECKING) && defined (USE_STACK_LISP_OBJECTS)
+
 /* Stress alloca with inconveniently sized requests and check
    whether all allocated areas may be used for Lisp_Object.  */
 
@@ -7134,11 +7138,11 @@
     }
 }
 
-#else /* not ENABLE_CHECKING */
+#else /* not (ENABLE_CHECKING && USE_STACK_LISP_OBJECTS) */
 
 #define verify_alloca() ((void) 0)
 
-#endif /* ENABLE_CHECKING */
+#endif /* ENABLE_CHECKING && USE_STACK_LISP_OBJECTS */
 
 /* Initialization.  */
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-09-09 03:44:06 +0000
+++ b/src/lisp.h        2014-09-09 11:43:22 +0000
@@ -4546,6 +4546,12 @@
       memory_full (SIZE_MAX);                                 \
   } while (false)
 
+/* This feature is experimental and requires very careful debugging.
+   Brave user should compile with CPPFLAGS='-DUSE_STACK_LISP_OBJECTS'
+   to get into the game.  */
+
+#ifdef USE_STACK_LISP_OBJECTS
+
 /* Use the following functions to allocate temporary (function-
    or block-scoped) conses, vectors, and strings.  These objects
    are not managed by GC, and passing them out of their scope
@@ -4582,9 +4588,12 @@
 
 #endif /* __GNUC__ etc... */
 
-/* Convenient utility macro similar to list2.  */
+/* Convenient utility macros similar to listX functions.  */
 
+#define scoped_list1(x) scoped_cons (x, Qnil)
 #define scoped_list2(x, y) scoped_cons (x, scoped_cons (y, Qnil))
+#define scoped_list3(x, y, z)                                  \
+  scoped_cons (x, scoped_cons (y, scoped_cons (z, Qnil)))
 
 /* True if Lisp_Object may be placed at P.  Used only
    under ENABLE_CHECKING and optimized away otherwise.  */
@@ -4622,7 +4631,7 @@
                 ((size) * word_size + header_size)),                   \
       obj = local_vector_init ((uintptr_t) XLI (obj), (size), (init))))
 
-/* Helper function for build_local_string, see below.  */
+/* Helper function for make_local_string, see below.  */
 
 INLINE Lisp_Object
 local_string_init (uintptr_t addr, const char *data, ptrdiff_t size)
@@ -4648,13 +4657,32 @@
    with contents DATA of length NBYTES.  Otherwise create regular
    GC-managed string.  */
 
-#define build_local_string(obj, data, nbytes)                          \
+#define make_local_string(obj, data, nbytes)                           \
   (MAX_ALLOCA < (nbytes) + sizeof (struct Lisp_String)                 \
    ? obj = make_string ((data), (nbytes))                              \
    : (obj = XIL ((uintptr_t) alloca                                    \
                 ((nbytes) + sizeof (struct Lisp_String))),             \
       obj = local_string_init ((uintptr_t) XLI (obj), data, nbytes)))
 
+/* We want an interface similar to make_string and build_string, right?  */
+
+#define build_local_string(obj, data)          \
+  make_local_string (obj, data, strlen (data))
+
+#else /* not USE_STACK_LISP_OBJECTS */
+
+#define scoped_cons(x, y) Fcons ((x), (y))
+#define scoped_list1(x) list1 (x)
+#define scoped_list2(x, y) list2 ((x), (y))
+#define scoped_list3(x, y, z) list3 ((x), (y), (z))
+#define build_local_vector(obj, size, init)            \
+  (obj = Fmake_vector (make_number ((size), (init))))
+#define make_local_string(obj, data, nbytes)   \
+  (obj = make_string ((data), (nbytes)))
+#define build_local_string(obj, data) (obj = build_string (data))
+
+#endif /* USE_STACK_LISP_OBJECTS */
+
 /* Loop over all tails of a list, checking for cycles.
    FIXME: Make tortoise and n internal declarations.
    FIXME: Unroll the loop body so we don't need `n'.  */


reply via email to

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