aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/alloc.c21
-rw-r--r--src/lisp.h16
3 files changed, 30 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8242a35e9ec..81122d45279 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
12012-07-20 Dmitry Antipov <dmantipov@yandex.ru> 12012-07-20 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Make maybe_gc inline.
4 Verify that inlining is always possible (GCC 4.7.1, -O3 -Winline).
5 * lisp.h (consing_since_gc, gc_relative_threshold)
6 (memory_full_cons_threshold): Revert declaration.
7 (maybe_gc): Remove prototype, define as inline.
8 * alloc.c: Remove old commented-out code.
9 (consing_since_gc, gc_relative_threshold)
10 (memory_full_cons_threshold): Revert to global.
11 (maybe_gc): Remove.
12
132012-07-20 Dmitry Antipov <dmantipov@yandex.ru>
14
3 Simple wrapper for make_unibyte_string, adjust font_open_by_name. 15 Simple wrapper for make_unibyte_string, adjust font_open_by_name.
4 * lisp.h (build_unibyte_string): New function. 16 * lisp.h (build_unibyte_string): New function.
5 * dosfns.c, fileio.c, fns.c, ftfont.c, process.c: 17 * dosfns.c, fileio.c, fns.c, ftfont.c, process.c:
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;
diff --git a/src/lisp.h b/src/lisp.h
index 2a598900146..2f426c38fc5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2593,10 +2593,12 @@ extern void mark_object (Lisp_Object);
2593#if defined REL_ALLOC && !defined SYSTEM_MALLOC 2593#if defined REL_ALLOC && !defined SYSTEM_MALLOC
2594extern void refill_memory_reserve (void); 2594extern void refill_memory_reserve (void);
2595#endif 2595#endif
2596extern void maybe_gc (void);
2597extern const char *pending_malloc_warning; 2596extern const char *pending_malloc_warning;
2598extern Lisp_Object zero_vector; 2597extern Lisp_Object zero_vector;
2599extern Lisp_Object *stack_base; 2598extern Lisp_Object *stack_base;
2599extern EMACS_INT consing_since_gc;
2600extern EMACS_INT gc_relative_threshold;
2601extern EMACS_INT memory_full_cons_threshold;
2600extern Lisp_Object list1 (Lisp_Object); 2602extern Lisp_Object list1 (Lisp_Object);
2601extern Lisp_Object list2 (Lisp_Object, Lisp_Object); 2603extern Lisp_Object list2 (Lisp_Object, Lisp_Object);
2602extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); 2604extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
@@ -3434,4 +3436,16 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3434 3436
3435#include "globals.h" 3437#include "globals.h"
3436 3438
3439/* Check whether it's time for GC, and run it if so. */
3440
3441static inline void
3442maybe_gc (void)
3443{
3444 if ((consing_since_gc > gc_cons_threshold
3445 && consing_since_gc > gc_relative_threshold)
3446 || (!NILP (Vmemory_full)
3447 && consing_since_gc > memory_full_cons_threshold))
3448 Fgarbage_collect ();
3449}
3450
3437#endif /* EMACS_LISP_H */ 3451#endif /* EMACS_LISP_H */