aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-20 17:14:58 +0400
committerDmitry Antipov2012-07-20 17:14:58 +0400
commitdac616ff9f51b77e399a06863a79446958c4f840 (patch)
treeed956a463f0efff837c7de4a9a61b31e2567d45a /src/alloc.c
parentbbf0e7d97893b9abfe6575a408f03e48543cb513 (diff)
downloademacs-dac616ff9f51b77e399a06863a79446958c4f840.tar.gz
emacs-dac616ff9f51b77e399a06863a79446958c4f840.zip
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.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 36040f70b2d..e7d67e95dbe 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -166,16 +166,16 @@ struct emacs_globals globals;
166 166
167/* Number of bytes of consing done since the last gc. */ 167/* Number of bytes of consing done since the last gc. */
168 168
169static EMACS_INT consing_since_gc; 169EMACS_INT consing_since_gc;
170 170
171/* Similar minimum, computed from Vgc_cons_percentage. */ 171/* Similar minimum, computed from Vgc_cons_percentage. */
172 172
173static EMACS_INT gc_relative_threshold; 173EMACS_INT gc_relative_threshold;
174 174
175/* Minimum number of bytes of consing since GC before next GC, 175/* Minimum number of bytes of consing since GC before next GC,
176 when memory is full. */ 176 when memory is full. */
177 177
178static EMACS_INT memory_full_cons_threshold; 178EMACS_INT memory_full_cons_threshold;
179 179
180/* Nonzero during GC. */ 180/* Nonzero during GC. */
181 181
@@ -5374,18 +5374,6 @@ bounded_number (EMACS_INT number)
5374 return make_number (min (MOST_POSITIVE_FIXNUM, number)); 5374 return make_number (min (MOST_POSITIVE_FIXNUM, number));
5375} 5375}
5376 5376
5377/* Check whether it's time for GC, and run it if so. */
5378
5379void
5380maybe_gc (void)
5381{
5382 if ((consing_since_gc > gc_cons_threshold
5383 && consing_since_gc > gc_relative_threshold)
5384 || (!NILP (Vmemory_full)
5385 && consing_since_gc > memory_full_cons_threshold))
5386 Fgarbage_collect ();
5387}
5388
5389DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 5377DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
5390 doc: /* Reclaim storage for Lisp objects no longer needed. 5378 doc: /* Reclaim storage for Lisp objects no longer needed.
5391Garbage collection happens automatically if you cons more than 5379Garbage collection happens automatically if you cons more than
@@ -5474,8 +5462,6 @@ See Info node `(elisp)Garbage Collection'. */)
5474 5462
5475 gc_in_progress = 1; 5463 gc_in_progress = 1;
5476 5464
5477 /* clear_marks (); */
5478
5479 /* Mark all the special slots that serve as the roots of accessibility. */ 5465 /* Mark all the special slots that serve as the roots of accessibility. */
5480 5466
5481 for (i = 0; i < staticidx; i++) 5467 for (i = 0; i < staticidx; i++)
@@ -5592,7 +5578,6 @@ See Info node `(elisp)Garbage Collection'. */)
5592 5578
5593 CHECK_CONS_LIST (); 5579 CHECK_CONS_LIST ();
5594 5580
5595 /* clear_marks (); */
5596 gc_in_progress = 0; 5581 gc_in_progress = 0;
5597 5582
5598 consing_since_gc = 0; 5583 consing_since_gc = 0;