Make maybe_gc inline.
authorDmitry Antipov <dmantipov@yandex.ru>
Fri, 20 Jul 2012 13:14:58 +0000 (17:14 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Fri, 20 Jul 2012 13:14:58 +0000 (17:14 +0400)
Verify that inlining is always possible (GCC 4.7.1, -O3 -Winline).
* lisp.h (consing_since_gc, gc_relative_threshold)
(memory_full_cons_threshold): Revert declaration.
(maybe_gc): Remove prototype, define as inline.
* alloc.c: Remove old commented-out code.
(consing_since_gc, gc_relative_threshold)
(memory_full_cons_threshold): Revert to global.
(maybe_gc): Remove.

src/ChangeLog
src/alloc.c
src/lisp.h

index 8242a35..81122d4 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-20  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Make maybe_gc inline.
+       Verify that inlining is always possible (GCC 4.7.1, -O3 -Winline).
+       * lisp.h (consing_since_gc, gc_relative_threshold)
+       (memory_full_cons_threshold): Revert declaration.
+       (maybe_gc): Remove prototype, define as inline.
+       * alloc.c: Remove old commented-out code.
+       (consing_since_gc, gc_relative_threshold)
+       (memory_full_cons_threshold): Revert to global.
+       (maybe_gc): Remove.
+
 2012-07-20  Dmitry Antipov  <dmantipov@yandex.ru>
 
        Simple wrapper for make_unibyte_string, adjust font_open_by_name.
index 36040f7..e7d67e9 100644 (file)
@@ -166,16 +166,16 @@ struct emacs_globals globals;
 
 /* Number of bytes of consing done since the last gc.  */
 
-static EMACS_INT consing_since_gc;
+EMACS_INT consing_since_gc;
 
 /* Similar minimum, computed from Vgc_cons_percentage.  */
 
-static EMACS_INT gc_relative_threshold;
+EMACS_INT gc_relative_threshold;
 
 /* Minimum number of bytes of consing since GC before next GC,
    when memory is full.  */
 
-static EMACS_INT memory_full_cons_threshold;
+EMACS_INT memory_full_cons_threshold;
 
 /* Nonzero during GC.  */
 
@@ -5374,18 +5374,6 @@ bounded_number (EMACS_INT number)
   return make_number (min (MOST_POSITIVE_FIXNUM, number));
 }
 
-/* Check whether it's time for GC, and run it if so.  */
-
-void
-maybe_gc (void)
-{
-  if ((consing_since_gc > gc_cons_threshold
-       && consing_since_gc > gc_relative_threshold)
-      || (!NILP (Vmemory_full)
-         && consing_since_gc > memory_full_cons_threshold))
-    Fgarbage_collect ();
-}
-
 DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
        doc: /* Reclaim storage for Lisp objects no longer needed.
 Garbage collection happens automatically if you cons more than
@@ -5474,8 +5462,6 @@ See Info node `(elisp)Garbage Collection'.  */)
 
   gc_in_progress = 1;
 
-  /* clear_marks (); */
-
   /* Mark all the special slots that serve as the roots of accessibility.  */
 
   for (i = 0; i < staticidx; i++)
@@ -5592,7 +5578,6 @@ See Info node `(elisp)Garbage Collection'.  */)
 
   CHECK_CONS_LIST ();
 
-  /* clear_marks (); */
   gc_in_progress = 0;
 
   consing_since_gc = 0;
index 2a59890..2f426c3 100644 (file)
@@ -2593,10 +2593,12 @@ extern void mark_object (Lisp_Object);
 #if defined REL_ALLOC && !defined SYSTEM_MALLOC
 extern void refill_memory_reserve (void);
 #endif
-extern void maybe_gc (void);
 extern const char *pending_malloc_warning;
 extern Lisp_Object zero_vector;
 extern Lisp_Object *stack_base;
+extern EMACS_INT consing_since_gc;
+extern EMACS_INT gc_relative_threshold;
+extern EMACS_INT memory_full_cons_threshold;
 extern Lisp_Object list1 (Lisp_Object);
 extern Lisp_Object list2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
@@ -3434,4 +3436,16 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
 
 #include "globals.h"
 
+/* Check whether it's time for GC, and run it if so.  */
+
+static inline void
+maybe_gc (void)
+{
+  if ((consing_since_gc > gc_cons_threshold
+       && consing_since_gc > gc_relative_threshold)
+      || (!NILP (Vmemory_full)
+         && consing_since_gc > memory_full_cons_threshold))
+    Fgarbage_collect ();
+}
+
 #endif /* EMACS_LISP_H */