aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorJohn Wiegley2016-01-11 22:51:27 -0800
committerJohn Wiegley2016-01-11 22:51:27 -0800
commitc7bef6a4f033fa6b22906de0be6da54958d5b3c3 (patch)
tree3a0f34b340ad01de290f068530c27f35aba83724 /src/alloc.c
parentf5d90b5fcf0251466055c7dbed6069c1850d802d (diff)
parent1f6898d0510cd15455f665c0f38451755a374243 (diff)
downloademacs-c7bef6a4f033fa6b22906de0be6da54958d5b3c3.tar.gz
emacs-c7bef6a4f033fa6b22906de0be6da54958d5b3c3.zip
Merge from origin/emacs-25
1f6898d test/automated/vc-hg.el: Support out-of-tree build 3adb56e Minor change in tramp-tests.el 2b535ba ; * etc/NEWS: Update the js.el entry. 76b518c * etc/HELLO: Add Armenian and Mongolian greetings. b51f1ef Java Mode: Fontify identifiers in the presence of annotations. 36b9539 Avoid an infloop when we run out of memory 2006752 Avoid unnecessary failures of auto-saving after fatal error eef6784 Simplify HAVE_MODULES use in mark_maybe_pointer 552694a Revert attempt to use 'noexcept' in typedef 6ad0d39 Update documentation of 'indirect-function' c6a5314 ; * etc/NEWS: Move entry of 'inhibit-point-motion-hooks'. 303141a Update documentation for obsoleting 'syntax-begin-function' 4e6f61c ; * etc/NEWS: Mark documented and not-to-be-documented entries. e667bbb Document new features if Eshell 9c4e4e0 ; * etc/NEWS: Update EUDC entries. 1089dc9 Handle too long commands in Tramp 684eb58 * .gitattributes: *.cur and *.pif are binary files too. d2c7fda * src/alloc.c (mark_maybe_pointer): HAVE_MODULES may be undefined bd3f53d * sh-script.el (sh-smie-sh-rules): Improve indentation inside $(...) 09b2b8a * src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value cca0f93 ; Account for spaces before the filename c71e1e8 Use short date for 'hg annotate', and output the author f50027b Spelling fix c7dff67 ; * etc/NEWS: Fix the Xref entries that got separated. cc140bc Document user-level functions in project.el f8208b6 Document the user-level features of the Xref package b131fb8 * loading.texi: Add `define-type' entry for load-history db3c2a8 Improve doc strings and prompts in xref.el f6117ef Allow the use of `font-lock-extend-region-multiline' in CC Mode. 90fd798 Fix coding system for Tramp on OS X. e985a0e ; * etc/NEWS: Mark the 'check-expensive' entry not to be documented. 9dfcbf0 Update 'load-history' docs 207e191 Fix (error ...) error 457738f Correctly analyze brace arguments in templated C++ function declarations. d57724a * lisp/cedet/mode-local.el (describe-function-orig-buffer): Declare. 2a9532d * lisp/ffap.el (ffap-latex-mode): Avoid free variable. 1a6b084 * lisp/play/dunnet.el (dun-fix-screen): Avoid `end-of-buffer`. 8be046f Respect fontification region calculated by major mode. Fixes bug #22316. 4b37cba Improve documentation of Delete Selection mode a034dd3 Fix two project-find-file issues 30abf29 Clarify doc string of 'dired-current-directory' e990bb2 Use the face of preceding text for displaying the ellipsis 5810ac3 Suppress Chinese file name test for OSX in tramp-tests.el eeb710a ; * lisp/startup.el: Sentences end with two spaces. 428b3de * admin/admin.el (set-version): Also handle the NEWS file. 648de81 ; Add NEWS entry for project.el 671862f apropos-library: Skip obvious duplicates; don't error on generics 51668a5 ; Grammar fix ed41d11 Add project-find-file and project-or-external-find-file 056da45 ; Improve commentary in 'setup_for_ellipsis' 269d008 ; Improve docstring for `inhibit-startup-echo-area-message'
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 9ec44b8a2c3..03dacc77c6e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3732,7 +3732,7 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
3732#ifdef HAVE_MODULES 3732#ifdef HAVE_MODULES
3733/* Create a new module user ptr object. */ 3733/* Create a new module user ptr object. */
3734Lisp_Object 3734Lisp_Object
3735make_user_ptr (void (*finalizer) (void*), void *p) 3735make_user_ptr (void (*finalizer) (void *), void *p)
3736{ 3736{
3737 Lisp_Object obj; 3737 Lisp_Object obj;
3738 struct Lisp_User_Ptr *uptr; 3738 struct Lisp_User_Ptr *uptr;
@@ -4594,6 +4594,10 @@ maybe_lisp_pointer (void *p)
4594 return (uintptr_t) p % GCALIGNMENT == 0; 4594 return (uintptr_t) p % GCALIGNMENT == 0;
4595} 4595}
4596 4596
4597#ifndef HAVE_MODULES
4598enum { HAVE_MODULES = false };
4599#endif
4600
4597/* If P points to Lisp data, mark that as live if it isn't already 4601/* If P points to Lisp data, mark that as live if it isn't already
4598 marked. */ 4602 marked. */
4599 4603
@@ -4607,8 +4611,17 @@ mark_maybe_pointer (void *p)
4607 VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); 4611 VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p));
4608#endif 4612#endif
4609 4613
4610 if (!maybe_lisp_pointer (p)) 4614 if (sizeof (Lisp_Object) == sizeof (void *) || !HAVE_MODULES)
4611 return; 4615 {
4616 if (!maybe_lisp_pointer (p))
4617 return;
4618 }
4619 else
4620 {
4621 /* For the wide-int case, also mark emacs_value tagged pointers,
4622 which can be generated by emacs-module.c's value_to_lisp. */
4623 p = (void *) ((uintptr_t) p & ~(GCALIGNMENT - 1));
4624 }
4612 4625
4613 m = mem_find (p); 4626 m = mem_find (p);
4614 if (m != MEM_NIL) 4627 if (m != MEM_NIL)
@@ -4685,8 +4698,7 @@ mark_maybe_pointer (void *p)
4685static void ATTRIBUTE_NO_SANITIZE_ADDRESS 4698static void ATTRIBUTE_NO_SANITIZE_ADDRESS
4686mark_memory (void *start, void *end) 4699mark_memory (void *start, void *end)
4687{ 4700{
4688 void **pp; 4701 char *pp;
4689 int i;
4690 4702
4691 /* Make START the pointer to the start of the memory region, 4703 /* Make START the pointer to the start of the memory region,
4692 if it isn't already. */ 4704 if it isn't already. */
@@ -4697,6 +4709,8 @@ mark_memory (void *start, void *end)
4697 end = tem; 4709 end = tem;
4698 } 4710 }
4699 4711
4712 eassert (((uintptr_t) start) % GC_POINTER_ALIGNMENT == 0);
4713
4700 /* Mark Lisp data pointed to. This is necessary because, in some 4714 /* Mark Lisp data pointed to. This is necessary because, in some
4701 situations, the C compiler optimizes Lisp objects away, so that 4715 situations, the C compiler optimizes Lisp objects away, so that
4702 only a pointer to them remains. Example: 4716 only a pointer to them remains. Example:
@@ -4715,13 +4729,11 @@ mark_memory (void *start, void *end)
4715 away. The only reference to the life string is through the 4729 away. The only reference to the life string is through the
4716 pointer `s'. */ 4730 pointer `s'. */
4717 4731
4718 for (pp = start; (void *) pp < end; pp++) 4732 for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT)
4719 for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT) 4733 {
4720 { 4734 mark_maybe_pointer (*(void **) pp);
4721 void *p = *(void **) ((char *) pp + i); 4735 mark_maybe_object (*(Lisp_Object *) pp);
4722 mark_maybe_pointer (p); 4736 }
4723 mark_maybe_object (XIL ((intptr_t) p));
4724 }
4725} 4737}
4726 4738
4727#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS 4739#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
@@ -5513,9 +5525,16 @@ garbage_collect_1 (void *end)
5513 don't let that cause a recursive GC. */ 5525 don't let that cause a recursive GC. */
5514 consing_since_gc = 0; 5526 consing_since_gc = 0;
5515 5527
5516 /* Save what's currently displayed in the echo area. */ 5528 /* Save what's currently displayed in the echo area. Don't do that
5517 message_p = push_message (); 5529 if we are GC'ing because we've run out of memory, since
5518 record_unwind_protect_void (pop_message_unwind); 5530 push_message will cons, and we might have no memory for that. */
5531 if (NILP (Vmemory_full))
5532 {
5533 message_p = push_message ();
5534 record_unwind_protect_void (pop_message_unwind);
5535 }
5536 else
5537 message_p = false;
5519 5538
5520 /* Save a copy of the contents of the stack, for debugging. */ 5539 /* Save a copy of the contents of the stack, for debugging. */
5521#if MAX_SAVE_STACK > 0 5540#if MAX_SAVE_STACK > 0
@@ -5646,7 +5665,7 @@ garbage_collect_1 (void *end)
5646 } 5665 }
5647 } 5666 }
5648 5667
5649 if (garbage_collection_messages) 5668 if (garbage_collection_messages && NILP (Vmemory_full))
5650 { 5669 {
5651 if (message_p || minibuf_level > 0) 5670 if (message_p || minibuf_level > 0)
5652 restore_message (); 5671 restore_message ();