From 765e61e391ee0937ff6b30510b6c4651064fe38e Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 20 Jul 2012 09:28:00 +0400 Subject: Cleanup calls to Fgarbage_collect. * lisp.h (maybe_gc): New prototype. (consing_since_gc, gc_relative_threshold, memory_full_cons_threshold): Remove declarations. * alloc.c (maybe_gc): New function. (consing_since_gc, gc_relative_threshold, memory_full_cons_threshold): Make them static. * bytecode.c (MAYBE_GC): Use maybe_gc. * eval.c (eval_sub, Ffuncall): Likewise. * keyboard.c (read_char): Likewise. Adjust call to maybe_gc to avoid dependency from auto-save feature. --- src/bytecode.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index acdf809971f..dca1e552dd0 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -423,15 +423,11 @@ unmark_byte_stack (void) /* Garbage collect if we have consed enough since the last time. We do this at every branch, to avoid loops that never GC. */ -#define MAYBE_GC() \ - do { \ - if (consing_since_gc > gc_cons_threshold \ - && consing_since_gc > gc_relative_threshold) \ - { \ - BEFORE_POTENTIAL_GC (); \ - Fgarbage_collect (); \ - AFTER_POTENTIAL_GC (); \ - } \ +#define MAYBE_GC() \ + do { \ + BEFORE_POTENTIAL_GC (); \ + maybe_gc (); \ + AFTER_POTENTIAL_GC (); \ } while (0) /* Check for jumping out of range. */ -- cgit v1.2.1 From 8271d59040b3d83fb3fc8cb23723538183b12ad4 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 1 Aug 2012 11:57:09 +0400 Subject: Use INTERNAL_FIELD for symbols. * src/lisp.h (SVAR): New macro. Adjust users. * src/alloc.c, src/bytecode.c, src/cmds.c, src/data.c, src/doc.c, src/eval.c: * src/fns.c, src/keyboard.c, src/lread.c, src/xterm.c: Users changed. * admin/coccinelle/symbol.cocci: Semantic patch to replace direct access to Lisp_Object members of struct Lisp_Symbol to SVAR. --- src/bytecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index dca1e552dd0..523d56bc97b 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -818,7 +818,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, && !EQ (val, Qunbound) && !XSYMBOL (sym)->redirect && !SYMBOL_CONSTANT_P (sym)) - XSYMBOL (sym)->val.value = val; + SVAR (XSYMBOL (sym), val.value) = val; else { BEFORE_POTENTIAL_GC (); -- cgit v1.2.1 From 663e2b3f88f9be61399e06dfc0b76700f90c6ca6 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 5 Aug 2012 19:47:28 +0400 Subject: Generalize common compile-time constants. * lisp.h (header_size, bool_header_size, word_size): Now here. (struct Lisp_Vector): Add comment. (struct Lisp_Bool_Vector): Move up to define handy constants. (VECSIZE, PSEUDOVECSIZE): Simplify. (SAFE_ALLOCA_LISP): Use new constant. Adjust indentation. * buffer.c, buffer.h, bytecode.c, callint.c, eval.c, fns.c: * font.c, fontset.c, keyboard.c, keymap.c, macros.c, menu.c: * msdos.c, w32menu.c, w32term.h, window.c, xdisp.c, xfaces.c: * xfont.c, xmenu.c: Use word_size where appropriate. --- src/bytecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 523d56bc97b..49369de33e9 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -536,7 +536,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, stack.byte_string = bytestr; stack.pc = stack.byte_string_start = SDATA (bytestr); stack.constants = vector; - if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth)) + if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); #if BYTE_MAINTAIN_TOP -- cgit v1.2.1 From c644523bd8a23e518c91b61a1b8520e866b715b9 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 7 Aug 2012 17:37:21 +0400 Subject: Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things. * src/lisp.h (struct Lisp_Symbol): Change xname to meaningful name since all xname users are fixed long time ago. Do not use INTERNAL_FIELD. (set_symbol_name, set_symbol_function, set_symbol_plist): (set_symbol_next, set_overlay_plist): New function. (struct Lisp_Cons): Do not use INTERNAL_FIELD. (struct Lisp_Overlay): Likewise. (CVAR, MVAR, SVAR): Remove. * src/alloc.c, src/buffer.c, src/buffer.h, src/bytecode.c: * src/cmds.c, src/data.c, src/doc.c, src/eval.c, src/fns.c: * src/keyboard.c, src/lread.c, src/nsselect.m, src/xterm.c: Adjust users. * src/.gdbinit: Change to use name field of struct Lisp_Symbol where appropriate. * admin/coccinelle/overlay.cocci, admin/coccinelle/symbol.cocci: Remove. --- src/bytecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 49369de33e9..5ac8b4fa2bd 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -818,7 +818,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, && !EQ (val, Qunbound) && !XSYMBOL (sym)->redirect && !SYMBOL_CONSTANT_P (sym)) - SVAR (XSYMBOL (sym), val.value) = val; + SET_SYMBOL_VAL (XSYMBOL (sym), val); else { BEFORE_POTENTIAL_GC (); -- cgit v1.2.1