aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorAndrea Corallo2020-08-02 17:36:29 +0200
committerAndrea Corallo2020-08-02 17:36:29 +0200
commite5095f0fd31764a729b4afebf8b5e868a09eef28 (patch)
tree9404b95851af889d2f3652db786bca6180394587 /src/alloc.c
parent7a161dc688f0eeee64e307a55efbc7d11bab3627 (diff)
parent99d1a66646b7450ad0be3e4471341b50fee7bdb5 (diff)
downloademacs-e5095f0fd31764a729b4afebf8b5e868a09eef28.tar.gz
emacs-e5095f0fd31764a729b4afebf8b5e868a09eef28.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/src/alloc.c b/src/alloc.c
index a31b4a045e2..12f53bdd6d8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1947,6 +1947,9 @@ resize_string_data (Lisp_Object string, ptrdiff_t cidx_byte,
1947 /* No need to reallocate, as the size change falls within the 1947 /* No need to reallocate, as the size change falls within the
1948 alignment slop. */ 1948 alignment slop. */
1949 XSTRING (string)->u.s.size_byte = new_nbytes; 1949 XSTRING (string)->u.s.size_byte = new_nbytes;
1950#ifdef GC_CHECK_STRING_BYTES
1951 SDATA_NBYTES (old_sdata) = new_nbytes;
1952#endif
1950 new_charaddr = data + cidx_byte; 1953 new_charaddr = data + cidx_byte;
1951 memmove (new_charaddr + new_clen, new_charaddr + clen, 1954 memmove (new_charaddr + new_clen, new_charaddr + clen,
1952 nbytes - (cidx_byte + (clen - 1))); 1955 nbytes - (cidx_byte + (clen - 1)));
@@ -4658,7 +4661,16 @@ mark_maybe_object (Lisp_Object obj)
4658 break; 4661 break;
4659 } 4662 }
4660 4663
4661 void *po = (char *) XLP (obj) + (offset - LISP_WORD_TAG (type_tag)); 4664 bool overflow
4665 = INT_SUBTRACT_WRAPV (offset, LISP_WORD_TAG (type_tag), &offset);
4666#if !defined WIDE_EMACS_INT || USE_LSB_TAG
4667 /* If we don't use wide integers, then `intptr_t' should always be
4668 large enough to not overflow. Furthermore, when using the least
4669 significant bits as tag bits, the tag is small enough to not
4670 overflow either. */
4671 eassert (!overflow);
4672#endif
4673 void *po = (char *) ((intptr_t) (char *) XLP (obj) + offset);
4662 4674
4663 /* If the pointer is in the dump image and the dump has a record 4675 /* If the pointer is in the dump image and the dump has a record
4664 of the object starting at the place where the pointer points, we 4676 of the object starting at the place where the pointer points, we
@@ -4869,7 +4881,7 @@ mark_memory (void const *start, void const *end)
4869 On a host with 32-bit pointers and 64-bit Lisp_Objects, 4881 On a host with 32-bit pointers and 64-bit Lisp_Objects,
4870 a Lisp_Object might be split into registers saved into 4882 a Lisp_Object might be split into registers saved into
4871 non-adjacent words and P might be the low-order word's value. */ 4883 non-adjacent words and P might be the low-order word's value. */
4872 p += (intptr_t) lispsym; 4884 p = (char *) ((uintptr_t) p + (uintptr_t) lispsym);
4873 mark_maybe_pointer (p); 4885 mark_maybe_pointer (p);
4874 4886
4875 verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); 4887 verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0);
@@ -4986,27 +4998,6 @@ typedef union
4986#endif 4998#endif
4987} stacktop_sentry; 4999} stacktop_sentry;
4988 5000
4989/* Force callee-saved registers and register windows onto the stack.
4990 Use the platform-defined __builtin_unwind_init if available,
4991 obviating the need for machine dependent methods. */
4992#ifndef HAVE___BUILTIN_UNWIND_INIT
4993# ifdef __sparc__
4994 /* This trick flushes the register windows so that all the state of
4995 the process is contained in the stack.
4996 FreeBSD does not have a ta 3 handler, so handle it specially.
4997 FIXME: Code in the Boehm GC suggests flushing (with 'flushrs') is
4998 needed on ia64 too. See mach_dep.c, where it also says inline
4999 assembler doesn't work with relevant proprietary compilers. */
5000# if defined __sparc64__ && defined __FreeBSD__
5001# define __builtin_unwind_init() asm ("flushw")
5002# else
5003# define __builtin_unwind_init() asm ("ta 3")
5004# endif
5005# else
5006# define __builtin_unwind_init() ((void) 0)
5007# endif
5008#endif
5009
5010/* Yield an address close enough to the top of the stack that the 5001/* Yield an address close enough to the top of the stack that the
5011 garbage collector need not scan above it. Callers should be 5002 garbage collector need not scan above it. Callers should be
5012 declared NO_INLINE. */ 5003 declared NO_INLINE. */
@@ -5042,16 +5033,14 @@ typedef union
5042 We have to mark Lisp objects in CPU registers that can hold local 5033 We have to mark Lisp objects in CPU registers that can hold local
5043 variables or are used to pass parameters. 5034 variables or are used to pass parameters.
5044 5035
5045 This code assumes that calling setjmp saves registers we need 5036 If __builtin_unwind_init is available, it should suffice to save
5037 registers.
5038
5039 Otherwise, assume that calling setjmp saves registers we need
5046 to see in a jmp_buf which itself lies on the stack. This doesn't 5040 to see in a jmp_buf which itself lies on the stack. This doesn't
5047 have to be true! It must be verified for each system, possibly 5041 have to be true! It must be verified for each system, possibly
5048 by taking a look at the source code of setjmp. 5042 by taking a look at the source code of setjmp.
5049 5043
5050 If __builtin_unwind_init is available (defined by GCC >= 2.8) we
5051 can use it as a machine independent method to store all registers
5052 to the stack. In this case the macros described in the previous
5053 two paragraphs are not used.
5054
5055 Stack Layout 5044 Stack Layout
5056 5045
5057 Architectures differ in the way their processor stack is organized. 5046 Architectures differ in the way their processor stack is organized.